I’m trying to work out how to get user meta data as part of the profile returned by /userinfo.
This article aludes to it being possible but IMO does a pretty poor job of explaining the steps.
You can also use the GET /userinfo endpoint to get a user’s user_metadata, however, you must first write a Rule to copy user_metadata properties to the ID token.
That last sentence could definitely do with some elaboration. In any case, I went to Rules, created a rule from the “Move user metadata attributes to profile root attributes” template. I saved it. But I still don’t get user meta returned in the profile.
Thanks for this! That works. Am I right that this should expose the meta data to the user info endpoint, rather than include the user meta directly within the JWT? That latter point would be great, as it would mean I don’t have to make an API call to Auth0 at all, but perhaps that’s not the done thing and again suggests my ignorance of JWT general practice!
Hmm, that’s not my experience currently. What the code you provided did do was make the user meta suddenly available within the response to /userinfo. The JWT itself does not contain any meta data, so far as I can see.
This produces a JWT which, when run through jwt.io, contains the below. Notice it doesn’t have the user meta in the payload, which is what I’m asking and I believe your previous reply said should be there.