Reputation: 1289
Why does a Blazor app completely reload/restart after B2C Authentication? Using Net 6.
Thanks, Mike
Upvotes: 2
Views: 846
Reputation: 106
This doesn't solve the actual Reload problem (the console still displays duplicate 'Login Success' logs from the OnLoginSucceed method) but this solution does provide a more seamless user experience.
When you register the AAD B2C authentication, set the LoginMode to "Redirect"
options.ProviderOptions.LoginMode = "Redirect";
Adding this line when I registered the AddMsalAuthentication service gave me my expected behavior.
This way when you log in the Authentication screen won't be a pop-up but will redirect you to the AAD B2C Authentication page. On success the user will only experience one page refresh and it won't seem like there are duplicate refreshes taking place.
This is the solution I took for my application and I can accept this for my UX - hope this provides a similar result for your case.
Upvotes: 2
Reputation: 82
As discussed here - https://learn.microsoft.com/en-us/answers/questions/616079/index.html
In standard OAuth authentication the browser is redirected to a remote token server where the login takes place. The token server redirects back to the application with an access token the Blazor application uses (Bearer) to access secured resources.
Upvotes: 0