redirect uri returns wrong uri

Søren Brønsted 1 Reputation point

In Azure AD for out Company (

on App > Authentication > Platform configurations > Web > Redirect URIs

I have configured 2 redirect uri for 2 different environments - test and production, but every time I login from the test environment the AAD redirects to the production environment even though the redirect url parameter is the url to the test environment. If I remove the production environment, it works.

Any explanation on this odd behavior?

Azure Active Directory
Azure Active Directory
An Azure enterprise identity service that provides single sign-on and multi-factor authentication.
13,547 questions
{count} votes

1 answer

Sort by: Most helpful
  1. James Hamil 12,976 Reputation points Microsoft Employee

    Hi @Søren Brønsted ,

    I understand that you are being directed to the wrong URL. You need to specify the redirect URI in the login URL and specify where the user and authorization code should be redirected. If you don't specify a Redirect URI in the Login URL, the user will be redirected to the first URL specified in the app's registration.

    To resolve this, you can follow the example in the Authorization Code Grant Flow documentation to specify the Redirect URI:{tenant}/oauth2/authorize?

    Otherwise you could list the URL that you want as the first one in the registration.

    Let me know if you have further questions.

    Additional reading: