I'm using angular-oauth2-oidc . I have the following setup:
oauthConfig.clientId = authConfig.clientId;
oauthConfig.redirectUri = this.checkURL(authConfig.redirectUri);
oauthConfig.scope = authConfig.scope;
oauthConfig.oidc = true;
oauthConfig.issuer = this.checkURL(authConfig.issuer);
oauthConfig.requireHttps = authConfig.requireHttps;
oauthConfig.silentRefreshRedirectUri = this.checkURL(authConfig.redirectUri + /silent-refresh.html');
this.oauthService.configure(oauthConfig);
this.oauthService.setupAutomaticSilentRefresh();
When performing a silent refresh, I need to get the new access token and pass it to other parts of the application. This is how I attempt to get the token:
this.oauthService.events.subscribe(({ type }) => {
switch (type) {
case 'token_refreshed':{
//This event doesn't get detected when the automatic silent refresh happens
break;
}
case 'silently_refreshed':{
//This event doesn't get detected when the automatic silent refresh happens
break;
}
case 'token_expires':{
this.oauthService.silentRefresh().then(()=>{
//Here I want to pass the new token to the other parts of the app
}).catch((err)=>{ return; });
break;
}
}
});
When I manually do the silent refresh, I get an error that says "validating access_token failed. wrong state/nonce.".
I have auto-silent refresh set up as well, however the events are not triggered when the silent refresh happens, so I can't pass the token to the other parts of the application there either.
Am I doing something wrong?
I'm using initImplicitFlow() BTW.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.