Hey, we are experiencing an issue when using third party flow with microsoft Entra. When you create ...
f
Hey, we are experiencing an issue when using third party flow with microsoft Entra. When you create new user in microsoft entra and try to login using supertokens, we receive error: THIRD_PARTY_ERROR_NO_EMAIL Any ideas what could be the cause?
r
hey @fdundjer have you configured the scope correctly?
f
This is BE error: NO_EMAIL_GIVEN_BY_PROVIDER
Scope: scope: [ 'Calendars.ReadWrite', 'OnlineMeetings.ReadWrite', 'email', 'openid', 'profile', 'User.Read', 'offline_access', ],
r
hmm. Have you made a custom provider for this?
f
Yes. It works for existing Entra users but not for new users. This is the response for user info we receive
Copy code
{
  "rawUserInfoFromProvider": {
    "fromIdTokenPayload": {
      "aud": "03770e37-5679-4401-********",
      "exp": 1707485704,
      "iat": 1707481804,
      "iss": "https://login.microsoftonline.com/afaafa60-418a-4f63-b08b-********/v2.0",
      "name": "ems2",
      "nbf": 1707481804,
      "oid": "0232ea99-2324-48db-********",
      "rh": "0.AagAYPqqr4pBY0-********.",
      "sub": "3Tew0F6RlfwN1Mml84MVYHx6OrMbX3J********",
      "tid": "afaafa60-418a-4f63-b08b-********",
      "uti": "sTwgUV9ucE2********",
      "ver": "2.0"
    },
    "fromUserInfoAPI": {
      "name": "ems2",
      "picture": "https://graph.microsoft.com/v1.0/me/photo/$value",
      "sub": "3Tew0F6RlfwN1Mml84MVYHx6OrMbX3J********"
    }
  },
  "thirdPartyUserId": "3Tew0F6RlfwN1Mml84MVYHx6OrMbX3J_********"
}
r
so there is no email in here
so in case the provider doesn't give an email, then you can tell supertokens to generate a fake email for the user
set
requireEmail: false
in the thirdparty config, and if the provider gives no email, then supertokens will generate a fake email and use that
f
If provider starts giving an email at some point, will supertokens override fake email address? eg. If user info response contains email in the future
r
yup
f
Sounds good, thanks @rp_st