I am able to get access token from B2C only if I define a custom scope for app registration (Expose an API section), see below:
I can't understand why I need it. So, it make sense to grant permissions for Microsoft Graph. Every time user allows MY APP to act on behalf of him (in my case during SSO login), MY APP can read user profile and B2C can return users info like email in b2c token.
If I omit custom scope, and will use something like openid, I will get next error
AADB2C90055: The scope 'openid' provided in request must specify a resource, such as 'https://example.com/calendar.read'.
I created an Azure AD B2C application and granted API permissions:
When I pass scope as
openid
, access token dint not get generated:When I pass scope with custom API, access token generated like below:
References:
Azure B2C login with Cypress oauth 2.0 - {tenant}.b2clogin.com - Stack Overflow by Sridevi
Error code reference - Azure AD B2C