Identityserver4 IdentityServer logoutId为空
我无法从IdentityServer4获取PostLogoutRedirectUri,因为我的注销操作上的logoutId始终为null。我检查过,PostLogoutRedirectUris属性与我发送的url完全相同,但仍然无法工作,logoutId始终为空 在深入研究之后,我发现抛出的错误之一是由于Identityserver4 IdentityServer logoutId为空,identityserver4,Identityserver4,我无法从IdentityServer4获取PostLogoutRedirectUri,因为我的注销操作上的logoutId始终为null。我检查过,PostLogoutRedirectUris属性与我发送的url完全相同,但仍然无法工作,logoutId始终为空 在深入研究之后,我发现抛出的错误之一是由于IsActiveContext未处于活动状态: 资料来源: 我就是找不到修复它的过程,也无法确认这是否是唯一的问题 日志: 代码: ClientStore: var client = n
IsActiveContext
未处于活动状态:
- 资料来源:
ClientStore
:
var client = new Client
{
ClientId = application.Key,
ClientName = application.Description,
AllowedGrantTypes = grantType,
AllowedScopes = new List<string>
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.OfflineAccess,
"role",
"openIdConnectClient"
},
AllowOfflineAccess = true,
AllowAccessTokensViaBrowser = true,
RedirectUris = new List<string> { application.Url },
PostLogoutRedirectUris = new List<string> { $"{application.Url}" },
RequireConsent = false,
ClientSecrets = new List<Secret> { new Secret(application.Key.Sha256()) }
};
var客户机=新客户机
{
ClientId=application.Key,
ClientName=application.Description,
AllowedGrantTypes=grantType,
AllowedScopes=新列表
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.OfflineAccess,
“角色”,
“openIdConnectClient”
},
AllowOfflineAccess=true,
AllowAccessTokensViaBrowser=true,
重定向URI=新列表{application.Url},
PostLogoutRedirectUris=新列表{$“{application.Url}”},
RequireSent=false,
ClientSecrets=new List{new Secret(application.Key.Sha256())}
};
请求:
我读过很多相关问题,例如但不限于:
clientpostlogutredirecturis
表中显示了正确的ClientId
?@WimOmbelets hi,您是指Client.postlogutredirecturis吗?如果是,是的,它就在那里。我将使用ClientStore中的代码更新我的问题。@WimOmbelets updated@eestein我遇到了完全相同的问题,并通过在我的资源api的选项中将SaveToken设置为true来解决它<代码>服务.AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme).AddIdentityServerAuthentication(选项=>{options.Authority=Configuration.GetValue(“AuthConfig:AuthorityEndpoint”);选项.ApiName=“someapi”;options.requirehttpsmatadata=true;options.SaveToken=true;})我遇到了完全相同的问题,在我的案例中,根本原因是IDM配置中postLogoutRedirectUri
末尾的额外斜杠,而在请求/connect/endsession
时,postLogoutRedirectUri
没有斜杠。