【问题标题】:How can I programmatically log out of Forge?如何以编程方式退出 Forge?
【发布时间】:2020-10-29 23:18:57
【问题描述】:

我从 Forge 社区博客关注了 this guide

博客建议加载一个将src 属性设置为https://accounts.autodesk.com/Authentication/LogOut 的iFrame

<iframe src="https://accounts.autodesk.com/Authentication/LogOut" />

虽然 iFrame 正确加载,但用户不会退出 Forge 平台。

在过去一周左右的某个时间之前,这种方法一直有效。现在,用户保持登录状态。

但是,手动打开一个新窗口并导航到 LogOut URL 确实会注销用户。

这似乎是一项新更改,但我找不到任何文档。

【问题讨论】:

    标签: autodesk-forge


    【解决方案1】:

    我以前用过这个,到目前为止我还没有遇到任何问题,基本上是去Nodejs SDK使用端点退出。

     // prepare sign out
      $('#signOut').click(function () {
        $('#hiddenFrame').on('load', function (event) {
          location.href = '/api/forge/oauth/signout';
        });
        $('#hiddenFrame').attr('src', 'https://accounts.autodesk.com/Authentication/LogOut');
        // learn more about this signout iframe at
        // https://forge.autodesk.com/blog/log-out-forge
      })
    

    【讨论】:

    • 这基本上是我过去几个月使用的代码。我在过去一周左右开始遇到问题。
    【解决方案2】:

    为了解决这个问题,我决定为注销 url 打开一个临时的新窗口。我对解决方案不满意,但它确实有效。

    const newWindow = open('https://accounts.autodesk.com/Authentication/LogOut');
    setTimeout(() => newWindow.close(), 500);
    

    【讨论】:

      猜你喜欢
      • 2015-07-12
      • 2011-10-22
      • 2023-03-29
      • 2011-09-13
      • 2017-12-19
      • 2011-02-18
      • 2016-01-02
      • 2022-07-06
      • 1970-01-01
      相关资源
      最近更新 更多