Read Metadata

You can read metadata using rules with the Management API and with Lock. You can also search for profile-related information in user_metadata, such as:

  • name
  • nickname
  • given_name
  • family_name

Rather than storing profile-related information in user_metadata, you can edit these user attributes on the normalized user profile. If you want to be able to edit these attributes, you must configure your connection sync with Auth0 so that user attributes will be updated from the identity provider only on user profile creation. Root attributes will then be available to be edited individually or by bulk import using the Management API.

When using the deprecated Search v2, beginning 1 September 2017 new tenants cannot search any of the app_metadata fields. Only tenants associated with paid subscriptions that were created on/before 31 August 2017 can search the app_metadata fields. This limitation does not apply to Search v3.

As an example, assume the following metadata is stored for a user with the email address

Read metadata with the Management API

Using the example metadata above, you can refer to specific items from the dataset in Rules or via a call to the Management API as follows:

Any valid JSON snippet can be used as metadata.

In Management APIv1, all metadata is stored in the metadata field. Data stored in this field is now available from the Management APIv2 as app_metadata.

Read metadata with Lock

Using the Lock library, you can read the user's user_metadata properties the same way you would read any other user profile property. This example retrieves the value associated with user_metadata.hobby using the example user metadata listed above:

For details on how to initialize lock refer to Auth0Lock(clientID, domain, options).

Keep Reading