Migrating rule Adding user details to access token to action

Hello,
I have a rule that adds the app_metadata to the Access Token.

function addEmailToAccessToken(user, context, callback) {
var namespace = ‘https://xyz.com/’;
context.accessToken[namespace + ‘app_metadata’] = user.app_metadata;
return callback(null, user, context);
}

For some reason, it appears user.metadata is not available in the M2M Actions context.

Can you please advise on how to migrate this feature to Actions?
Thanks

Hi @jlfreymond,

Welcome to the Auth0 Community!

Firstly, please see our Migrate from Rules to Actions docs for more information on migrating from Rules to Actions.

When authenticating against a M2M (client credentials grant flow), it is not interactive and does not require any user interaction. Therefore when using the Machine to Machine Flow flow, there is no event.user object.

Here are some helpful documentation:

Hoped this helps!

Please let me know if you have any questions.

Thank you.