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WQiOiI3ODQwNDhmOS03NDNlLTRjN2UtYWFiYS1mY2Y4NzQ4NTc2NDEtYjJjXzFfc2lnbl9pbl91cCIsInV0aWQiOiI5YTlmNzI4Mi1jODFlLTRmNGQtYWQ1OC0xZjI5ZmYyNmFmYTcifQ",
"scope": "https://schoolconnectb2c.onmicrosoft.com/8372140c-6128-4bf7-8d68-4bb29b48a97a/API.ReadWrite",
"refresh_token": "eyJraWQiOiJjcGltY29yZV8wOTI1MjAxNSIsInZlciI6IjEuMCIsInppcCI6IkRlZmxhdGUiLCJzZXIiOiIxLjAifQ..lRPIdIPYV-fzAWPg.UKjBOKSaNLTzLeR5SFVmPRo_VFwEGjS0SF7D2oxG5YURFAsCd-kWh9_2BQQTOAfFoY4xYt2oVRKB78xF8bb9el35qBWtaspSJuf9DNu4D2qOjsdoqu8pWgcTghig6VmbGBuLBrNnUwvRYrxxa2XKZhCbWDoMiuzcC4GCNhXSIsbDuVejszFFcf0xtcNtMLdWx4o3rYpzdqgIOBKtA-zg7NwXxfAskWpzNQwpriBYl763REZmFuclzW_pv8y8cvF-j10KCb04mNwNSgnYeXh_Ih2o2A3_8jIA6ztHmpMNwiYFkoaFwKueAjmWbamMQNiKy8NNyf_R2TQLjXiC0kG0pmNqFmgx44wTrrkoS9AU_yUZ6t48jNSUFt-UJ2bBM_EUwghc3stSVAwFCgYvuCgoJmhCZUEUbHN9GIDBkmwgdsjsVPM7lsYZ_Fhh51yOC7fQiBwJyEKf3BF4EIDlygwi6BRiBKuW0Q7SQDQnUAwsqoQwg2-eJU3Y6IkYBNOTzXq25ruemjLvLMAYYEhXcfIEzD92-sXeqPdbRoXutC0bhRLDKKLG21h_8ULHVi1FriPhj0hU3ke-Wb3_rdJKcNoJu7lUxnG9scQ4XF_vRHtKsi5JH24bWieNAQbTNuMGCgWHvfaokxM94IJWfmHKsNYqfzpB-g-Ut03Vo2iSiGyVGWQ.z8P3G47q7NlbbXJ9qkhtvw",
"refresh_token_expires_in": 86400
}
After this it is neither going inside this IF statement that says if user is authenticated then go in:
public class CustomIdentityMiddleware(RequestDelegate next)
{
private readonly RequestDelegate _next = next;
public async Task InvokeAsync(HttpContext http, UserService userService)
{
//if (http.User.Identity?.IsAuthenticated == true)
if (http.User.Identity.IsAuthenticated)
{
var objectId = http.User?.Claims?.SingleOrDefault(o => o.Type == ClaimTypes.NameIdentifier)?.Value;
if (objectId != null)
{
And it is also not able to make any API request:
Request URL:
https://localhost:5161/api/user/get-all-users
Request Method:
GET
Status Code:
401 Unauthorized
Remote Address:
[::1]:5161
Referrer Policy:
strict-origin-when-cross-origin
Blazor WASM frontend, .NET backend. Any help would be highly appreciated because i am out of ideas.