Reactjs with Azure Ouath

100 Views Asked by At

We use ReactJs in our Application(which is built using Adobe AEM + Reactjs). It is not SPA project we use the reactjs component in some pages and we render using ReactDOM.render using DOM element.

We want to do SSO for particular page component, not for entire site. We have proper Azure tenant and client id.

  1. We used react-aad-msal npm to achieve this. But the url goes like https://login.microsoftonline.com/common//discovery/instance? instead of https://login.microsoftonline.com//oauth2/v2.0/authorize. I didn't know what mistake we are doing here.

2)Do we have better approach or npm to achieve this in component level instead of my first approach.

Thanks in advance.

1

There are 1 best solutions below

0
On

Microsoft is currently in process of building an official @azure/msal-react library which will replace react-aad-msal. While this library will remain till then, it is not recommended for new applications since it relies on the older MSAL 1.0 dependencies, which are based on the old authentication flow which has known issues. There will be some intermediary updates to help support a migration path to the official library, but at this point, react-aad-msal is scheduled to be deprecated. In case this app is in the early days of development, I would suggest implementing @azure/msal-react library. Learn more here.