IdentityServer 报错:"idp claim is missing"

一个使用 IdentityServer4 的 ASP.NET Core 项目在完成登录后跳转到 /connect/authorize/callback 时报错,对应的错误日志如下:

Unhandled exception: idp claim is missing

System.InvalidOperationException: idp claim is missing

at IdentityServer4.Extensions.PrincipalExtensions.GetIdentityProvider(IIdentity identity)

at IdentityServer4.Extensions.PrincipalExtensions.GetIdentityProvider(IPrincipal principal)

at IdentityServer4.ResponseHandling.AuthorizeInteractionResponseGenerator.ProcessLoginAsync(ValidatedAuthorizeRequest request)

at IdentityServer4.ResponseHandling.AuthorizeInteractionResponseGenerator.ProcessInteractionAsync(ValidatedAuthorizeRequest request, ConsentResponse consent)

at IdentityServer4.Endpoints.AuthorizeEndpointBase.ProcessAuthorizeRequestAsync(NameValueCollection parameters, ClaimsPrincipal user, ConsentResponse consent)

at IdentityServer4.Endpoints.AuthorizeEndpoint.ProcessAsync(HttpContext context)

at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)

请问如何解决?

回答

问题补充:

正常时的 Claims

{

"sub": "bd42420b-63cf-dd11-9e4d-001cf0cd135",

"idp": "local",

"amr": "pwd",

"auth_time": "1613349406"

}

报错时的 Claims

{

"sub": "bd42420b-63cf-dd11-9e4d-001cf0cd1235"

}

以上是 IdentityServer 报错:"idp claim is missing" 的全部内容, 来源链接: www.h5w3.com/114924.html

回到顶部