Azure AD B2C Always redirected to login

Michael Vanderpool 41 Reputation points
2021-02-02T21:06:43.087+00:00

I have a new Blazor Server application in .Net 5.0. Using the setup wizard, I entered the necessary information to connect to a new Azure AD B2C , and created the project. I set up the Azure AD using the following document (as well as the additional steps in the nav bar):

https://learn.microsoft.com/en-us/azure/active-directory-b2c/tutorial-create-tenant

For information that I followed during the setup of the Blazor project, I used these articles:

https://learn.microsoft.com/en-us/aspnet/core/security/authentication/azure-ad-b2c?view=aspnetcore-5.0
https://medium.com/marcus-tee-anytime/azure-ad-b2c-quickstart-with-visual-studio-blazor-563efdff6fdd

With no additional changes to the project or the AD, I ran the Blazor project. Upon running the project, I am redirected to the login screen for the AD instead of the index page with the ability to login. Once logging in, everything works as expected (unless you log off). I verified there are no Authorized tags on the Blazor pages or components. What am I doing wrong?

Thanks,
Michael

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,767 questions
0 comments No comments
{count} votes

Accepted answer
  1. Michael Washington 911 Reputation points MVP
    2021-02-02T22:04:39.747+00:00

    Make sure you do not have .RequireAuthorization(); in your Startup.cs file.

    In this Server-Side Blazor app: https://blazorsimplesurvey.azurewebsites.net/ you do not have to log in (unless you want to).
    The code for the app is here: https://github.com/ADefWebserver/BlazorSimpleSurvey
    You can compare that code to your own.

    Also see: Blazor and Azure B2C: The Big Picture

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful