Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to parse azure active directory token, and how to get all the user details based on the azure token in node.js?

I am using azure active directory OAuth for azure bot authentication.After logged in I got the token successfully, but how can I get the user details based on the token?

So, Is there is any way to parse the azure token in node.js and get the details about the user?

like image 894
Prakash Avatar asked Feb 01 '26 13:02

Prakash


1 Answers

Basically the token you get is a JWT token base64 encoded. You can use a node package like jwtDecode to decode the contents of the token and get the claims.

You can do something like:

import jwtDecode from 'jwt-decode';
const claims = jwtDecode('base64 encoded token received from Azure AD');

claims will be a JavaScript object.

like image 187
Gaurav Mantri Avatar answered Feb 04 '26 03:02

Gaurav Mantri



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!