[英]“validating access_token failed. wrong state/nonce.” when performing silentRefresh manually
我正在使用angular-oauth2-oidc 。 我有以下设置:
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();
执行静默刷新时,我需要获取新的访问令牌并将其传递给应用程序的其他部分。 这是我尝试获取令牌的方式:
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;
}
}
});
手动执行无提示刷新时,出现错误,提示“验证access_token失败。错误的状态/时间。”。
我还设置了自动静默刷新,但是在进行静默刷新时不会触发事件,因此我也无法将令牌传递到该应用程序的其他部分。
难道我做错了什么?
我正在使用initImplicitFlow()BTW。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.