I am working on Azure AD B2C for my Angular 6 front-end App and consuming Microsoft Graph API in order to change the singed-in user's password. I am getting the access_token
using the Authorization Code flow.
It works fine when the user has a username like [email protected]
, I get an access_token
and then call https://graph.microsoft.com/v1.0/users/{id}/changePassword
.
But when I try to do the same for users with a username like [email protected]
or [email protected]
, I get an error when acquiring the access_token from
Authorization Code flow (grant_type=password
). Note: These users are "local" accounts in my AAD B2C tenant
Following is the error message I get:
{
"error": "invalid_grant",
"error_description": "AADSTS50034: To sign into this application the account must be
added to the myb2cname.onmicrosoft.com directory.
Trace ID: 8fcae061-5088-4393-9e5b-d0a83d1d0a00
Correlation ID: 0dc6c906-c54b-4cd8-ae8b-46f3f6118e40
Timestamp: 2018-08-01 06:16:55Z",
"error_codes": [
50034
],
"timestamp": "2018-08-01 06:16:55Z",
"trace_id": "8fcae061-5088-4393-9e5b-d0a83d1d0a00",
"correlation_id": "0dc6c906-c54b-4cd8-ae8b-46f3f6118e40"
}
How can I call changePassword
for users who are signed in using the email identity provider (SignIn-SignUp Policy) when their username looks like [email protected]
or [email protected] instead
of [email protected]
?