【问题标题】:IBM Bluemix AppID - how log off / log out?IBM Bluemix AppID - 如何注销/注销?
【发布时间】:2019-05-10 05:14:02
【问题描述】:

在使用 IBM Bluemix App ID 时,有人知道如何注销用户吗? GitHub 示例应用程序和 README 上的 Node.js 服务器 SDK 包含以下参考:

const LOGOUT_URL = "/ibm/bluemix/appid/logout";

我尝试了各种排列方式,但我无法找出用于注销用户的 URL(主机名和扩展名)。

有人可以帮忙吗?

非常感谢。

【问题讨论】:

    标签: ibm-cloud ibm-appid


    【解决方案1】:

    根据https://www.ibm.com/developerworks/library/iot-trs-secure-iot-solutions3/index.html 的帖子,'在撰写本文时没有明确的“注销”方法'。

    完成一些挖掘后,终止会话将提供注销功能。这可以在 Node.js 中通过以下方式实现:

    app.get("/logout", function(req, res){
            // Destroy the session
            req.session.destroy();
            //return the main html file
            res.sendfile(__dirname + '/views/index.html');
    });
    

    【讨论】:

      【解决方案2】:

      要注销用户,您可以在注销端点上使用 WebAppStrategy,如下所示:

      app.get("/logout", function(req, res, next) {
          WebAppStrategy.logout(req);
          // If you chose to store your refresh-token, don't forgot to clear it also in logout:
          res.clearCookie("refreshToken");
          res.redirect("/");
      });
      

      查看 WebAppStrategy https://github.com/ibm-cloud-security/appid-serversdk-nodejs 上的 Node SDK 自述文件。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-21
        • 2016-05-30
        • 2014-03-31
        相关资源
        最近更新 更多