devlife
devlife

Reputation: 16155

Error using MSAL on Blazor WASM Hosted prerender

I'm using a basic Blazor WASM ASPNET Core Hosted WebAssemblyPrerendered .NET 6 app. However, when I try to try to login, I get the following.

There was an error trying to log you in: 'Cannot read properties of undefined (reading 'redirectUri')'

Any ideas as to what the issue could be?

Upvotes: 2

Views: 379

Answers (1)

Fried
Fried

Reputation: 1470

I succeeded by comparing the microsoft examples with my own code. Microsoft lead me to a github repository. In my case (and my authentication configuration) following lines were missing. This may differ on your scenario.

// Program.cs ...
builder.Services.AddMsalAuthentication(options =>
{
  builder.Configuration.Bind("AzureAd", 
    options.ProviderOptions.Authentication);
});

Upvotes: 0

Related Questions