添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement . We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken on callback to localhost/signin-oidc Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken on callback to localhost/signin-oidc CShelton11 opened this issue May 13, 2019 · 2 comments

Getting the below error on the callback to admin.

System.Exception: An error was encountered while handling the remote login. ---> System.InvalidCastException: Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken.
at Newtonsoft.Json.Linq.Extensions.Convert[T,U](T token)
at Newtonsoft.Json.Linq.JToken.Value[T](Object key)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.Claims.UniqueJsonKeyClaimAction.Run(JObject userData, ClaimsIdentity identity, String issuer)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.GetUserInformationAsync(OpenIdConnectMessage message, JwtSecurityToken jwt, ClaimsPrincipal principal, AuthenticationProperties properties)
at Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.HandleRemoteAuthenticateAsync()
--- End of inner exception stack trace ---
at Microsoft.AspNetCore.Authentication.RemoteAuthenticationHandler`1.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.CspMiddleware.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
at NWebsec.AspNetCore.Middleware.Middleware.MiddlewareBase.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Used fiddler to inspect the token and it appears to be valid:

"nbf":1557723053,
"exp":1557723353,
"iss":" https://localhost:44375 ",
"aud":"mvc",
"nonce":"636933198520552778.YjVlMzNlZDEtNDhmMi00OTk1LTg5NTAtMTViYTI3Nzg4NDk2ZTM0Y2E0NzQtYzRkZC00MmU0LWE3OTQtNDQ2MWIxZGM3NTYy",
"iat":1557723053,
"at_hash":"-YM87bCq4duw6VNah6Al_w",
"sid":"2d15ec96c8cf81074ac7917fea3bfd26",
"sub":"f86e073b-4500-476d-8e05-b77a95cfca82",
"auth_time":1557704309,
"idp":"local",
"name":"Alice Smith",
"given_name":"Alice",
"family_name":"Smith",
"email":[
" [email protected] "
"website":" http://alice.com ",
"preferred_username":"alice",
"amr":[
"pwd"

Any ideas why it would have this issue and how I can fix it?