npm angular-oauth2-oidc 令牌已过期问题

时间:2021-02-03 05:50:57

标签: angular9 angular-oauth2-oidc

enter image description here在我的应用程序中间,我收到“令牌已过期”问题,请帮助我如何订阅令牌过期方法并注销应用程序或增加过期时间。请找到以下错误截图供您参考。提前致谢。

1 个答案:

答案 0 :(得分:0)

您需要在令牌过期前刷新令牌。查看文档 here (if you're using Code Flow)here (if you're using implicit flow)

在您的 fun triggerRestart(context: Activity) { val intent = Intent(context, MainActivity::class.java) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) context.startActivity(intent) if (context is Activity) { (context as Activity).finish() } Runtime.getRuntime().exit(0) } 文件中,您还可以尝试在配置 oAuthService 后(调用 app.component.ts 后)订阅“token_expires”事件

this.oauthService.loadDiscoveryDocumentAndTryLogin();
相关问题