oauthService.getAccessToken()在angular-oauth2-oidc中返回null
下面给出了使用angular-oauth2-oidc使用AD FS验证angular SPA的代码oauthService.getAccessToken()在angular-oauth2-oidc中返回null,angular,oauth-2.0,adfs,angular-oauth2-oidc,Angular,Oauth 2.0,Adfs,Angular Oauth2 Oidc,下面给出了使用angular-oauth2-oidc使用AD FS验证angular SPA的代码 initializeOAuthService(): void { this.oauthService.configure({ redirectUri: window.location.origin + '/app/search', requireHttps: true, scope: 'openid profile email', re
initializeOAuthService(): void {
this.oauthService.configure({
redirectUri: window.location.origin + '/app/search',
requireHttps: true,
scope: 'openid profile email',
responseType: 'id_token token',
oidc: true,
clientId: environment.adfsClientId,
loginUrl: environment.adfsUrl + '/oauth2/authorize',
issuer: environment.adfsUrl,
logoutUrl:
environment.adfsUrl +
'/ls/?wa=wsignoutcleanup1.0&wreply=' +
location.protocol +
'//' +
location.hostname +
(location.port ? ':' + location.port : ''),
postLogoutRedirectUri:
location.protocol +
'//' +
location.hostname +
(location.port ? ':' + location.port : ''),
});
this.oauthService.tokenValidationHandler = new JwksValidationHandler();
this.oauthService.setStorage(localStorage);
if (!this.oauthService.hasValidAccessToken()) {
console.log('no access token available');
this.oauthService
.loadDiscoveryDocumentAndTryLogin()
.then(() => {
if (!this.oauthService.hasValidAccessToken()) {
this.oauthService.initImplicitFlow();
}
})
.catch((error) => {
console.log(error);
});
}
// this.oauthService.setupAutomaticSilentRefresh();
}
我可以成功登录到应用程序,并且可以在URL中看到访问和id标记
但当我调用“oauthService.getAccessToken()或”this.oauthService.getIdentityClaims()”时,结果是null
谁能告诉我我错过了什么
注意:我已经从登录组件的构造函数调用了上述方法。登录页面和AD FS重定向到的页面不同