Home > Back-end >  Azure AD Registered App Returns 404 on default redirect
Azure AD Registered App Returns 404 on default redirect

Time:09-05

Doing some practice with AZ 204, I was attempting to set up a simple web app with .Net Core and a simple Authentication system using the login.microsoftonline.com service. My problem is that I keep getting a 404 on my redirect from the authentication sequence.

I use a redirect provided from Azure under "Get Started" using the Web platform for ASP.NET Core. The only modification I used is that I have replaced the localhost port as mine is running on a different one.

The app works fine without Authorization, With Authorization in place, it loads in the Microsoft login page, and it goes through, the process and validates the user. It goes through and manages the user consent screen, but once it's supposed to redirect back to the page (using the /signin-oidc endpoint, it seems to interpret it as a webpage and goes to the URL htttps://localhost:7032/signin-oidc.

I made the same setup progress a week ago without any 404 problems.

Run from Visual Studios

  • Service: Azure AD Registered App

  • Platform configuration: Web (ASP.NET Core)

  • Redirect URIs: https://localhost:7032/signin-oidc, https://localhost:7032/

  • Front-channel logout URL: https://localhost:7032/signout-oidc

  • ID tokens (used for implicit and hybrid flows): checked

  • Double checked ClientID: check

  • Double checked TenantID: check

  • UseAuthentication() is enabled: checked

CodePudding user response:

You may need add UseAuthentication() in your Startup.Configure method.

app.UseRouting();
app.UseAuthentication(); // <-- Add it here.
app.UseAuthorization();

CodePudding user response:

Unsure how, but as I started the project today the code runs smoothly, and the page loads properly. My guess is it might have been some problem with my internet settings on my local machine. Thanks for the suggestions and bonus help.

  • Related