如何以编程方式注销 Forge?

How can I programmatically log out of Forge?

我关注了 this guide 来自 Forge 社区博客。

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

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

虽然 iFrame 加载正常,但用户没有退出 Forge 平台。

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

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

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

我过去用过这个,到目前为止我没有遇到任何问题,基本上是转到 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
  })

为了解决这个问题,我决定为登出url开一个临时新的window。我对解决方案不满意,但它起作用了。

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