Redirecting url from Identity server 4 is not behaving as expected and “Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken” error

后端 未结 2 802
梦如初夏
梦如初夏 2021-01-15 07:12

Note : After resolving the redirection issue i had an another issue that is getting an error \"Cannot cast Newtonsoft.Json.Linq.JArray to Newtonsoft.Json.Linq.JToken\". So i

2条回答
  •  轮回少年
    2021-01-15 07:42

    I had the same problem with having multiple roles. Here is the solution for it:

    .AddOpenIdConnect("oidc", options =>
    {
        // ...
        options.Scope.Add("roles");
    
        // ... using MapJsonKey instead of MapUniqueJsonKey for having 2 or more roles
        options.ClaimActions.MapJsonKey(claimType: "role", jsonKey: "role");
    });
    

提交回复
热议问题