Custom Oauth2 Social Connection occasionally throws "InternalOAuthError: Failed to obtain access token (status: 500...)"

Problem statement

Auth0 occasionally throws this error in Failed Login; however, it’s not clear what is happening. Can we have more details on what this error is related to?

Raw details:

{
...
 "type": "f",
 "description": "InternalOAuthError: Failed to obtain access token (status: 500 data: <HTML><HEAD>
<TITLE>Internal Server Error</TITLE>
</HEAD><BODY>
<H1>Internal Server Error - Read</H1>
The server encountered an internal error or misconfiguration and was unable to
complete your request.<P>
Reference&#****
</BODY></HTML>
 )",
...
}

Cause

    • Auth0 sends the state and code to the token endpoint of the IdP to exchange for the token, but Auth0 was unable to retrieve the access token as the IdP returned an Internal Server Error.

Solution

You will have to debug this issue with your IdP and check whether it has some downtime and why it returned with an Internal server error intermittently.