Home > Mobile >  Azure MSAL Authentication and custom JWT Authentication in Blazor
Azure MSAL Authentication and custom JWT Authentication in Blazor

Time:01-24

I'm trying to add Azure MSAL Authentication to an existing Blazor WASM application that already handles authentication with JWT. But if I register a custom AuthenticationStateProvider I use, blazor throw at runtime:

Unhandled exception rendering component: Specified cast is not valid. System.InvalidCastException: Specified cast is not valid.

Looking through sources, It seems it throws because an MSAL class expects that IServiceProvider returns an IRemoteAuthenticationService<TRemoteAuthenticationState> as AuthenticationStateProvider see enter image description here

Reference: .net core - Custom AuthenticationStateProvider Authentication Failing - Stack Overflow

  • Related