How do I integrate Azure AD SSO authentication with ReactJS web application?

srihitha pakala 1 Reputation point
2019-12-16T11:41:02.397+00:00

We have developed a web application with frontend in ReactJS and middleware APIs in NodeJS. The frontend and middleware are hosted through 2 seperate azure web app services. In order to integrate SSO with the application, we have followed all the steps in the document: “https://learn.microsoft.com/en-us/azure/app-service/app-service-web-tutorial-auth-aad” till the topic “configure app service to return usable token”. However, we did not make any code changes since we could not find any implementation in ReactJS. Post entering the credentials, the applications redirects to callback URL (i.e. Redirect URI) and the url throws 500 internal server error.
The authentication used to work when we added the reply URL, it started throwing this error post we added the token configuration. Is there anything that has to be added to code to resolve this issue?

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,790 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,313 questions
{count} votes

2 answers

Sort by: Most helpful
  1. FrankHu-MSFT 976 Reputation points
    2019-12-17T18:19:21.17+00:00

    The cookie/token will be sent in the headers in the request from the AAD Server to your Node JS Server with the key :X-MS-TOKEN-AAD-ACCESS-TOKEN

    I suggest taking a look at the blog below for more details on how to get an access token from an app service.

    https://blogs.msdn.microsoft.com/aaddevsup/2018/02/28/configuring-an-app-service-to-get-an-access-token-for-graph-api/


  2. xequence 6 Reputation points
    2019-12-22T06:20:20.17+00:00
    0 comments No comments