So, i know this is unique to each application, but I am hoping someone has seen behavior like this and might have a way forward.
We currently have a Blazor appliction with a locally hosted Identity Server 4 authentication model (with OIDC), and are working on migrating it to Auth0. However, we are having something of a problem.
Currently, upon going to the index page, users would be prompted to login, and then redirected to the application page on success. When i first updated the application, i replaced the settings found in builder.Services.AddAuthentication with all of the Auth0 settings for OIDC. Doing this method, we do get directed to the Auth0 page, but following the login, we get stuck in an infinite loop bouncing between our page and Auth0.
Doing some research, we found that Auth0 of course has its own API, so I worked on implementing that. With the API in place, making the call to the index now simply fails (even with the same settings). Through some trial and error however, i made some progress:
If i remove the portion of the program.cs with:
builder.Services.AddAuthorization(options =>
{
// By default, all incoming requests will be authorized according to the default policy
options.FallbackPolicy = new AuthorizationPolicyBuilder()
.RequireAuthenticatedUser()
.Build();
// Register other policies here
});
and make a manual call to a basic login page i made, not only do i log in, i get redirected to my application with the successful login where i can use all the credentials. However, i cannot get the code to go to this login page by default, as other parts of the application (that require authorization) fail before the page is presented.
I realize this sounds like a mess, so hopefully that is the start of some dialog i can work with and make some progress… Happy to answer questions people may have to help clarify…