Blazor app Reload after B2C authentication

Michael Lambert 1 Reputation point
2021-11-04T21:15:56.2+00:00

Why does a Blazor app completely reload/restart after B2C Authentication?
146656-image.png

Here is the callback:
146657-image.png

Thanks,
Mike

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,382 questions
Microsoft Entra External ID
Microsoft Entra External ID
A modern identity solution for securing access to customer, citizen and partner-facing apps and services. It is the converged platform of Azure AD External Identities B2B and B2C. Replaces Azure Active Directory External Identities.
2,633 questions
{count} votes

4 answers

Sort by: Most helpful
  1. AgaveJoe 26,191 Reputation points
    2021-11-05T16:01:44.427+00:00

    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.

    0 comments No comments

  2. James Hamil 21,546 Reputation points Microsoft Employee
    2021-11-05T21:35:25.177+00:00

    Hi @Michael Lambert , @AgaveJoe is correct in his answer. The app needs to reload in order to pull resources from Azure in order to display related data. Please let me know if you have any questions!

    Best,
    James

    0 comments No comments

  3. Michael Lambert 1 Reputation point
    2021-11-19T23:16:41.027+00:00

    I kinda understand the cause, but it leads to a horrid user experience. When logging in, right after the login screen disappears you can see that the app reacts to the successful login by updating the <AuthorizeView><Authorized>view on the page but then immediately reloads the app. Its like ripping the rug right out from under the user and making them wait another few seconds while the app reloads..


  4. Bruce (SqlWork.com) 55,196 Reputation points
    2021-11-20T15:40:36.03+00:00

    The login code supports a pop up instead or redirect, but most browsers now block this, so the redirect is required. Security is also blocking iframe implementations.

    If the hosting server supports authentication, you can do a simple api call to get a token instead of the oauth flow.

    0 comments No comments