Closed CShelton11 closed 5 years ago
I think that one of the claim which should be a single value is returned as an array. What about email address?
That was it. Had forgot to go into the claims table and change the email address to match what was in the aspnetusers table.
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":[
"AliceSmith@email.com" ], "website":"http://alice.com", "preferred_username":"alice", "amr":[
"pwd" ] }
Any ideas why it would have this issue and how I can fix it?