carlfranklin / MsalAuthInBlazor

Call a Secure Web API with MSAL Authentication against Azure AD B2C
5 stars 2 forks source link

Msal Auth in Blazor Server doesn't work in production. #2

Open tanakamawere opened 4 months ago

tanakamawere commented 4 months ago

It works and authenticates users successfully when debugging locally but when I push the code into production, it doesn't work. You just click the button and it doesn't go anywhere. I have added logging and it doesn't show any error.

// Create PCA once. Make sure that all the config parameters below are passed
        PCA = PublicClientApplicationBuilder
                .Create(_settings?.ClientId)
                .WithB2CAuthority(_settings?.Authority)
                .WithLogging((level, message, containsPii) =>
                {
                    Console.WriteLine($"[{level}] {message}");
                }, Microsoft.Identity.Client.LogLevel.Always, enablePiiLogging: false, enableDefaultPlatformLogging: true)
                .WithRedirectUri("http://localhost")
                .Build();

Should redirect uri still be localhost? I need help there. If not, what should it be for the app to authenticate users in production? Right now when I click the button, it doesn't do anything.

The website is accessible at https://medbase.co.zw and try to log in and see what happens