Custom Claims Missing from ID Token with Wordpress

Problem statement

When trying to pull custom claims from the ID token in Wordpress, it appears that the user profile data does not have any of the custom claims that were added in an action.

Cause

Depending on the auth flow being used, the user information may be getting pulled from the Management API instead of from the ID token. The Management API will not return custom claims.

Solution

The auth0_use_management_api_for_userinfo filter defaults to true if you use a flow other than the Implicit Flow. If you set it to false, it will use the ID token instead, and custom claims will be available.

See the documentation on auth0_use_management_api_for_userinfo for more details.

1 Like