Error retrieving AzureAD profile


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?