So I am running my Blazor client wasm SPA, along with my .net core web api. When I call my API with the access token that the user has, my API labels the user as authorized. But when I try to use AuthorizeView
or the Authorize
attribute on my frontend it labels the user as unauthenticated even though a non-expired access token exists in local storage.
I am using auth0’s AuthenticationStateProvider. This is how i am configuring OpenID Authentication va program.cs:
builder.Services.AddOidcAuthentication(options =>
{
options.ProviderOptions.Authority = $"https://{builder.Configuration["Auth0:Domain"]}";
options.ProviderOptions.ClientId = builder.Configuration["Auth0:ClientId"];
options.ProviderOptions.DefaultScopes.Add("openid");
options.ProviderOptions.DefaultScopes.Add("profile");
options.ProviderOptions.DefaultScopes.Add("offline_access");
});