Auth0 Home Blog Docs

Unable to fetch user info through userprofile API


Hello Team,
After adding open ID and profile, I am still not getting the user profile on making an ajax request at /userInfo . The end point only returns ‘sub’ while it should actually return the complete user profile including the name and details for that particular user. Can you help me in this?

Thank you


I believe by default the /userinfo endpoint will only have standard claims (attributes) defined in the OIDC specification and more specifically only the ones that correspond to the requested scope. If we want to receive back additional details, we will need to add custom claims that are added via a Rule. More information about this can be found in this document.

What specific details for the particular user were you expecting to receive?


This is what i am seeing in userprofile endpoint. Why i am not seeing name of user as per Auth0 documentation?


@kimcodes Any updates on my issue?


I apologize for the delay I did not spot your response. What scopes are you specifying in your authorize request?


@kimcodes we tried using 2 scopes openid and profile but it didnt worked.


did you include the two scopes openid profile in the scope parameter in the initial authentication request (when you get your access token) ? Can you check the JWT you receive when you authenticate? I believe the userInfo will only return the sub of the user for scope openid . If you want the user_metadata you’ll need to add it through a custom claim to the id token.


@kimcodes Thanks for your reply. Can you guide me how to add through a custom claim to the id token? Also what all information we will receive in user_metadata?


a sample would look like this:

function (user, context, callback) {
  const namespace = ''; // note you cannot use, or as a namespace identifier
  context.idToken[namespace + 'favorite_color'] = user.favorite_color;
  context.idToken[namespace + 'preferred_contact'] = user.user_metadata.preferred_contact;
  callback(null, user, context);

The user metadata is associated with the user and will depend on what you set for the user.


@kimcodes Thanks for detailed explanation. When i was reading standard claims i found sub and name are both part or OIDC but we only get sub and not name. Here is the link to standard claims :

Is there anything wrong in our auth0 config?


@kimcodes Any update on my above question? I would appreciate if you could help me in getting detailed explanation of my above question which might help in solving the issue?


@kimcodes I am waiting for any update on my question?


Hey there @keval.sheth, I apologize for the delay. I was hoping to follow up today and see if you are still experiencing an issue receiving your desired dataset? If by chance you are, do you mind sharing a sample when you get a minute? Thanks in advance!

closed #16

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.