Skip to content

Azure AD B2C Invalid email / username or password on sign in #6999

Discussion options

You must be logged in to vote

SOLUTION

The issue came from the JWT sent by AZURE AD B2C auth which do not contains email or preferred_username fields expected by Azure AD authentication.
The JWT from b2c returns an array emails.

I fix this by changing the following lines in "/server/modules/authentication/azure/authentication.js" file.

we changed:

const usrEmail = _.get(profile, '_json.email', null) || _.get(profile, '_json.preferred_username')

for:

const emails = _.get(profile, '_json.emails', null)
const usrEmail = _.get(profile, '_json.email', null) || _.get(profile, '_json.preferred_username') || emails[0]

Also the JWT from B2C doesn't contain the oid.
I also change this lines to fix this:

from:

profile: {
      …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lfernandes00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant