Microsoft oAuth redirecting to root instead of “home” url when using microsoft Azure application authentication

Conrad, Wyatt 1 Reputation point
2021-04-21T12:13:06.827+00:00

I am using MVC.net with "sign in with microsoft" as the login. (sample application)

First, everything works on localhost.

I have registered my app on the AZ portal, with a redirect URL of https://xxxxxxx.com/xxx/Home/Index I have a web.config redirect uri that matches

when I publish the application and sign in with microsoft it authenticates, then redirects to https://xxxxxxx.com/xxx/Home/Index as a Post with form data of (string code, string id_token, string state, string session_state) with 302 error

which then redirects to the root https://xxxxxxx.com

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
21,702 questions
{count} votes

1 answer

Sort by: Most helpful
  1. VipulSparsh-MSFT 16,271 Reputation points Microsoft Employee
    2021-05-13T14:52:19.633+00:00

    @Conrad, Wyatt Thanks for reaching out and apologies for delay on this.

    Azure AD will redirect the session to anything which is configured as redirect url on App registration page which needs to match with your postLogoutRedirectURI in web.config

    http status : 302 is a valid redirect to the current session and if above things are correct, you can collect a fiddler trace to understand which entity redirected it further.

    -----------------------------------------------------------------------------------------------------------------

    If the suggested response helped you resolve your issue, please do not forget to accept the response as Answer and "Up-Vote" for the answer that helped you for benefit of the community.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.