如何解决npm angular-oauth2-oidc 令牌已过期问题
在我的应用程序中间,我收到“令牌已过期”问题,请帮助我如何订阅令牌过期方法并注销应用程序或增加过期时间。请找到以下错误截图供您参考。提前致谢。
解决方法
您需要在令牌过期前刷新令牌。查看文档 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();
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。