Error retrieving AzureAD profile

Hi,

We integrated our Auth0 applications with a Microsoft social connection and everything works fine except one weird issue: when we try to authenticate the user for the first time after Microsoft registration Auth0 cannot extract the Azure AD profile and create the account, but it works well when we try the second time.

The general context data that we get in Auth0 monitoring logs is:

{
  "body": {},
  "qs": {
    "code": "...",
    "state": "..."
  },
  "connection": "windowslive",
  "error": {
    "message": "Error retrieving AzureAD profile",
    "oauthError": "invalid_request",
    "type": "request-error"
  },
  "session_id": "..."
}

This is not a latency-related issue, it doesn’t matter if we are waiting for one minute or one hour before we try to sign-in for the first time after registration on Microsoft, it will do the same.

Do you have any idea about this issue?

1 Like

Sorry to bump an old thread, but in case anyone else stumbles on this problem I found the solution.

For some reason using the Auth0 dev keys with MS social causes this problem, if you set up your own application in Microsoft AD and use that application key and client secret everything works just fine. It’s just an issue with the Auth0 dev keys.