priyatham ik
priyatham ik

Reputation: 11

MSAL with MERN stack web app for authentication and authorization

I have got a scenario where I need to implement the authentication and authorization using Azure AD b2c through MSAL, where I'm confused should I use MSAL for nodejs or the react js one. I have gone through official msal-nodejs documentation however its kind of unclear. It would be great if any one can help me on how to achieve this or if you have any example of msal with MERN stack app that would be great!

Upvotes: 1

Views: 976

Answers (1)

Sérgio Correia
Sérgio Correia

Reputation: 586

Check the below MERN example: https://github.com/Azure-Samples/ms-identity-javascript-react-tutorial/tree/main/3-Authorization-II/2-call-api-b2c

Essentially:

  • MSAL-React is used to handle the authentication of the React frontend.
  • From your React frontend, you call your Node.js API passing the accessToken acquired with the help of MSAL.
  • Passport.js is used on the Node.js API to validate the accessToken

Upvotes: 2

Related Questions