Identityserver4 静默刷新-在自定义登录URL上使用隐式流时刷新访问令牌

Identityserver4 静默刷新-在自定义登录URL上使用隐式流时刷新访问令牌,identityserver4,oidc-client-js,Identityserver4,Oidc Client Js,我在Angular中使用IdentityServer4(.NET Core API)和“oidc客户端”,其中我使用的是自定义登录和注销URL,而不是默认的IdentityServer4 URL,因此在这个场景中,来自“oidc客户端”的静默刷新请求。它返回302,但令牌有时会自动过期 IdentityServer 4: services.AddIdentityServer(opt => { opt.UserInteraction.LoginUrl = "/

我在Angular中使用IdentityServer4(.NET Core API)和“oidc客户端”,其中我使用的是自定义登录和注销URL,而不是默认的IdentityServer4 URL,因此在这个场景中,来自“oidc客户端”的静默刷新请求。它返回302,但令牌有时会自动过期

IdentityServer 4:

services.AddIdentityServer(opt =>
{
                opt.UserInteraction.LoginUrl = "/User/Login";
                opt.UserInteraction.LogoutUrl = "/User/Logout";
                opt.Events.RaiseErrorEvents = true;
                opt.Events.RaiseFailureEvents = true;
                opt.Events.RaiseInformationEvents = true;
                opt.Events.RaiseSuccessEvents = true;
})
oidc客户端:

getClientSettings(): UserManagerSettings {
        return {
            authority: localStorage.getItem('authorizationRoot'),
            client_id: 'MileTMSAngapp',
            redirect_uri: localStorage.getItem('redirectUri'),
            post_logout_redirect_uri: 
            localStorage.getItem('postLogoutRedirectUri'),
            response_type: 'id_token token',
            scope: 'openid profile MileTMS',
            filterProtocolClaims: false,
            loadUserInfo: true,
            automaticSilentRenew: true,
            silent_redirect_uri: localStorage.getItem('silentRedirectUri')
        };
    }
“静默回调”:

 return this.manager.signinSilentCallback()
        .then(doSomething => 'done');

您在控制台中看到了什么样的错误

你提供的信息很少,我猜你正面临这个问题。希望这能有所帮助


控制台中没有错误,我也可以在网络中看到静默请求,尽管如此,令牌在指定时间之前过期如果我没有错,令牌不会过期,请检查会话Cookie(IDSRV)的有效时间。您是否也使用jwt.io检查令牌有效性?