简体   繁体   中英

How to get user profile info in Authorization code flow Azure AD B2C?

In Auth Code flow, azure tenant provides a auth code upon successful authentication( username/pwd ), then this code can be traded for access_token (useful to protect our resource APIs). When I use this access_token to get profile details using graph /me endpoint I'm getting invalid token exception. So, how can I get user profile details in this flow?

Appreciate your help!!

An access token can be used only for one resource.

The access token which is for your resource API cannot be used to call Microsoft Graph.

You should set scope=https://graph.microsoft.com/.default offline_access during getting code and access token.

But currently it's not supported to get access token for Microsoft Graph via Request an access token in Azure Active Directory B2C . It's only for protecting your APIs.

You need to follow Get access on behalf of a user to get the access token with Auth Code flow.

Implicit flow is the only flow supported for SPA. Authorization code flow is intended for webapps, mobile and desktop apps but not for SPA.Please refer to this document

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