Auth0 Actions for M2M to return Application metadata in JWT

Trying to leverage Auth0 actions to add Application Metadata to the Token for M2M credentials
Using the following in the Actions to setCustomClaim but not sure what permissions needed to be set in the Auth0 Management API to return this information in the JWT.

The Application Metadata was setup with a key “testKey” and the Action used in M2M flow is below

/**
* Handler that will be called during the execution of a Client Credentials exchange.
*
* @param {Event} event - Details about client credentials grant request.
* @param {CredentialsExchangeAPI} api - Interface whose methods can be used to change the behavior of client credentials grant.
*/
exports.onExecuteCredentialsExchange = async (event, api) => {
  api.accessToken.setCustomClaim('appData', event.client.metadata['testKey']);
};

Hi @shakil.riyad,

Welcome to the Auth0 Community!

Make sure you are following the namespacing guidelines outlined here: Create Custom Claims

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