Getting user_metadata with auth0-spa-js?

Hi @Cobalt,

it’s important to understand the difference between app_metadata and user_metadata as described here.

That said, it is possible for an end user to request an access token that is valid for the Auth0 Management API from within a SPA, however, that comes with limited scopes, i.e. you can only request user_metadata of your own user but not app_metadata, and obviously also no information about other users.

Therefore, two approaches, the first one being the easiest imo:

  1. Option: Create a rule and add the info as custom claims into the ID token.

  2. Option (but unnecessary more complex): Request an access token for the Auth0 management API (via respective audience option parameter in the request), with the value of https://YOUR_TENANT.auth0.com/api/v2/, which can be used to request user information.