Defining a valid redirect_uri causing major problems when trying to get a live (msal) React app working with Microsoft Identity Platform at Azure (App Service)

Jussi Rantapere 20 Reputation points
2023-03-16T12:14:49.6166667+00:00

I have developed further a small React application originating from the MS msal example. The app is working locally and as I use https://localhost:3000/ as redirect_uri (defined also in the app registration) the autentication/authorization are working just fine.

After I deployed the application to Azure ( https:/{exampleapp}.azurewebsites.com ) the redirection won't work as I expect but I get an error message: invalid_request: "The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application."

I have tried numerous variations but the problem remains. I even created a web.config file, but that file is likely not used anywhere.

Please ask me if you need any detailed information to solve this kind of problem. Thank you in advance.

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,003 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,808 questions
0 comments No comments
{count} votes

Accepted answer
  1. 2023-03-17T03:41:05.3433333+00:00

    Hello, to avoid getting "The provided value for the input parameter 'redirect_uri' is not valid. The expected value is a URI which matches a redirect URI registered for this client application" error you need to ensure your React application is configured to use one of the reply URLs configured in your Azure AD app registration. Web.config files are used for ASP.NET and ASP.NET applications but not for React. React applications usually bring settings embbeded within its compiled/transpiled/minized code, so it's important to ensure environment specific values are being set before build.

    Let us know if you need additional assistance. If the answer was helpful, please accept it and complete the quality survey so that others can find a solution.


1 additional answer

Sort by: Most helpful
  1. Deleted

    This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.


    Comments have been turned off. Learn more