如何解决如何刷新角度angular-oauth2-oidc代码id_token?
我在我的角度应用程序中使用angular-oauth2-oidc。我的oauth配置在这里:
public static OauthConfig: AuthConfig = {
issuer: 'http://myoauth.server',requireHttps: false,responseType: "code",redirectUri: window.location.origin + '/index.html',clientId: 'dashboard.dev.code',scope: 'openid profile',logoutUrl: window.location.origin + '/index.html',postLogoutRedirectUri: window.location.origin + '/index.html'
}
我正在使用我的组件。
export class AppComponent {
constructor(private oauthService: OAuthService){
this.oauthService.configure(AppSettings.OauthConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndLogin();
}
get hasValidToken(){
return this.oauthService.hasValidIdToken();
}
}
并在hasValidToken()
中使用app.component.html
<div class="container-fluid" *ngIf="hasValidToken">
....
</div>
但是几分钟后,出现白色空白页。因为 hasValidToken 为false,但是访问令牌为true。
- 如何默默刷新id_token?
- 或者在id_token有效后如何运行
this.oauthService.initCodeFlow()
?我找不到令牌过期的任何事件。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。