I want to add a login with Microsoft
button to my mean-stack application. So I am using passport-microsoft.
By using passport.authenticate('microsoft', { scope: ['User.Read'] })
, I could get these information: @odata.context
, givenName
, surname
, displayName
id
, userPrincipalName
, businessPhones
, jobTitle
, mail
, mobilePhone
, officeLocation
, preferredLanguage
. For me, my userPrincipalName
is an email address, whereas my mail
is null
.
I have setup the application as follows, but if I write passport.authenticate('microsoft', { scope: ['User.Read', 'email'] })
, the authentication gave me an "invalid scope" error.
Does anyone know how to setup my application and request to get the email address of a user?