microsoft-authentication-library-for-python icon indicating copy to clipboard operation
microsoft-authentication-library-for-python copied to clipboard

[Bug] Validate Azure access token in Django Rest API and call graph API

Open Shriyanshmit opened this issue 1 year ago • 3 comments

Hello Team,

Form Angular application using MSAL, I login to azure and receive accessToken. Now to pull data from API I am passing access token as bearer in header of API. Now please let me know how I can validate/authorize this token in backend Django rest api.

Do we have any in built function or module that I need to install and validate? If not please let me know how I can validate/authorize my token and call graph api to get additional information of user.

Shriyanshmit avatar Jun 30 '24 04:06 Shriyanshmit

MSAL itself is a token acquisition library, not a token validation one, so you would need to look for alternative solution when it comes to token validation.

@rayluo is this something that PyJWT would fit the bill for?

localden avatar Jul 20 '24 00:07 localden

I have been reading the docs for the past couple of days trying to figure out this same usecase. They are very unclear on this topic.

KevinVanthuyne avatar Dec 19 '24 17:12 KevinVanthuyne

Token validation itself is out-of-scope for MSAL, as it is just a token acquisition library. PyJWT might be a start here.

localden avatar Jan 08 '25 01:01 localden