Skip to content

Is it possible to use Azure AD B2C authentication on wiki.js? #7006

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]

PS: we can only add other emails from the azure ad b2c portal, so it's a valid solution

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
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