Auth0 Enterprise OIDC Connection Fails With Error Calling Userinfo Due To Non-String Sub Claim

Overview

An Auth0 Enterprise OpenID Connect (OIDC) connection fails at the callback step because the upstream Identity Provider (IdP) returns a non-string subject claim. Resolving this requires adjusting the attribute map to use token set claims instead of userinfo claims or correcting the upstream IdP response. The connection fails with a generic error, even though authentication succeeds at the upstream IdP.

The tenant log displays the following details:

type: "f"
description: "Error calling userinfo"
error.oauthError: "invalid_request"
error.type: "request-error"
details.upstream_userinfo_fetch.status: "FAILURE"

NOTE: The upstream_userinfo_fetch field only indicates success or failure and does not capture the underlying HTTP status code or response body from the IdP.

Applies To

  • Auth0
  • Enterprise OpenID Connect (OIDC) Connections

Cause

The upstream IdP /userinfo endpoint returns a JSON response where the sub (subject) field is not a string (for example, null, a number, a boolean, or an object). OpenID Connect Core 1.0 requires the sub claim to be a string. Auth0 performs strict runtime validation of the /userinfo response and throws an OAUTH_INVALID_RESPONSE error when the IdP violates this constraint. This failure occurs during plain JSON body validation, prior to any JSON Web Signature (JWS) or JSON Web Encryption (JWE) processing.

 

The error only occurs when Auth0 calls the IdP /userinfo endpoint. This triggers when the connection attribute_map references ${context.userinfo.*} claims and a corresponding userinfo_scope is configured.

Solution

What resolves the userinfo error?

Verify the failure point by bisecting the attribute map and adjust the configuration to avoid calling the userinfo endpoint.

  1. Configure the attribute map to use only ${context.tokenset.*} claims.
  2. Test the connection to confirm if the /userinfo response is the point of failure.
  3. Contact the upstream IdP administrator to correct the /userinfo endpoint response so that the sub claim returns as a JSON string.
  4. Leave the attribute map configured to use only ${context.tokenset.*} claims if the ID token contains all necessary user information.

Recommended content

No recommended content found...