简体   繁体   中英

How do I verify the token I receive from logging into my Angular App (Azure AD / MSAL) when making an API HTTP request to NodeJS?

Currently where I am is this. I followed the Microsoft documentation to where a user can login to Angular front end via Azure Active Directory.

I followed this tutorial: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-angular-auth-code

This then populate my local storage with various details including an idtoken and accesstoken.

My hope is to then send a token to my backend (NodeJS), and have it validate the token before executing the API and then sending back the result.

Previously I was able to do this with middleware and leveraging Cognito but I am being forced to switch to Azure AD for Auth.

Any help would be greatly appreciated as I am currently at a loss. Thank you.

Check this: https://www.npmjs.com/package/validate-azure-ad-token

I think this library made just for you

If you are using a @azure/msal-react or @azure/msal-browser on the frontend site and you just want to verify your Microsoft access token on your node server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM