首页 > 解决方案 > 用户的空闲状态(使用 ngIdle)正在中断,同时使用角度 5 中的 Iframe 从身份服务器静默刷新访问令牌

问题描述

我的应用程序如何工作。

我每 10 分钟使用Iframe从身份服务器刷新一次令牌。我在我的应用程序中使用ngIdle来跟踪用户的空闲情况。

每 10 分钟调用一次刷新

setInterval(() =>{
 this.refreshToken();
},100000);

使用 iframe 调用 URL

refreshToken(){
let iframe =document.createElement('iframe');
iframe.id ="refreshToken";
iframe.setAttribute('src',"/connect/tokenclient_id=client1& client_secret=secret&grant_type=authorization_code&code=hdh922&redirect_uri=https://myapp.com/callback");
document.body.appendChild(iframe)
}

如果用户空闲同时又调用了silentrefresh,则用户的空闲时间被中断并重新启动。

我已经尝试从 iframe 中访问其他一些 URL,但这并没有中断空闲。它只发生在身份服务器的情况下

标签: iframeangular5identityserver4refresh-tokenng-idle

解决方案


推荐阅读