Azure b2c and Blazor web app Custom login flow

thunder12 41 Reputation points
2022-06-15T21:20:07.18+00:00

I am using Azure b2c for authentication in Blazor app. my login process starting from a different page not necessarily the default home page.

The app needs to be redirected to the same page and restored it's state after the successful login with B2C.

I am looking at the additional scenario page for ideas, but It doesn't help much. https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/additional-scenarios?view=aspnetcore-3.1#customize-the-user

Any ideas or guides welcomed.

Thanks

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,390 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,640 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Takahito Iwasa 4,841 Reputation points MVP
    2022-06-15T22:23:03.637+00:00

    Hi, @thunder12

    First, the behavior you want is the behavior of a typical web application.
    Azure AD and B2C redirect to a specific URL.
    In this case, the general approach is to specify the URL you want to return to as a parameter, re-receive the parameter at the callback destination from Azure ADB2C, and redirect it independently.

    Please refer to the following "Use a state parameter".
    https://learn.microsoft.com/en-us/azure/active-directory/develop/reply-url#use-a-state-parameter

    The application can then use the value in the state parameter to determine which URL to further send the user to. Make sure you validate for CSRF protection.

    1 person found this answer helpful.