0

我希望用户在每次打开 Angular 6 SPA 时重定向以登录,该 SPA 使用身份服务器作为 angular-oauth-oidc 的授权服务器进行保护。

我正在使用 OAuth 2.0 隐式流程让用户使用 Angular SPA 登录。

我尝试清除 sessionStorage 或 localStorage 但它不起作用。如何使用这个库实现上述功能?

this.oauthService.configure(authConfig);
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.loadDiscoveryDocumentAndTryLogin().then(() => {
  // If there is a valid access token
  if (this.oauthService.hasValidAccessToken()) {
  }
});
4

0 回答 0