Get Client object or application data when using auth0-react sdk in SPA

I am using auth0-react sdk to integrate auth0 in my application.

on auth0 platform I have setup some application data in application’s advanced settings

I need to know how can I get those application data key-value pairs using auth0-react

or if there is any other way to get it in my react app

Hey there @reshad welcome to the community!

In the context of a user, you can add this metadata as a custom claim in tokens using an Action - Otherwise, you could just use the Management API /api/v2/clients/{id} endpoint.

A Post Login Action utilizing event.client.metadata might look something like:

exports.onExecutePostLogin = async (event, api) => {
  // Check if a specific metadata field exists in the client's metadata
  if (event.client.metadata && event.client.metadata.someSpecialFlag === 'true') {
    // Perform a specific action if the flag is set to true
    // For example, adding a custom claim to the ID token
    api.idToken.setCustomClaim("https://example.com/special_user", true);
  }
};

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