Can I set two different Redirect URL (Reply URL) inside a SPA application inside Azure AD

1.7k views Asked by At

I am running a React application. I have registered this application with Azure AD (got one client id). I am also implementing oAuth using Azure React MSAL package.

I am running this application locally and planning to host it on Azure App service as well. This means I will be running two instances of this application. Once running locally & other running on App Service.

Inside Azure > Azure AD > App Registration > Select your app > Authentication, We set the Redirect URLs.

A redirect URI, or reply URL, is the location where the authorization server sends the user once the app has been successfully authorized and granted an authorization code or access token. The authorization server sends the code or token to the redirect URI, so it's important you register the correct location as part of the app registration process.

My question is, since I am running two applications against one ClientID, Can I specify more than one redirect URI ? or I need to register more than one client application? For example:

http://localhost:3000/ https://myhostedSite.com

1

There are 1 answers

0
Gaurav Mantri On

Yes, you can have multiple redirect URIs per application (app registration). Please make sure that the redirect URI is set correctly in the code when sending the authentication request so that once the user is authenticated successfully, they are redirect back to the correct application.

Please see this link for more details: https://learn.microsoft.com/en-us/azure/active-directory/develop/reply-url#maximum-number-of-redirect-uris.