Thanks so much for sharing @sefer !
From my side, I would like to also let you know that to interact with the Auth0’s Management API (to update user profile data like given_name
or family_name
) you could use within this Action our “auth0” library instead of writing your own function.
A simplified code sample form our Github repo (it updates user metadata):
exports.onExecutePostLogin = async (event, api) => {
import { ManagementClient } from 'auth0';
const management = new ManagementClient({
domain: '{YOUR_TENANT_AND REGION}.auth0.com',
clientId: '{YOUR_CLIENT_ID}',
clientSecret: '{YOUR_CLIENT_SECRET}',
});
await management.users.update({ id: '{user id}' }, { user_metadata: { foo: 'bar' } });
}
I’m sharing it in case you would like to compare performance of calling our Management API with a custom function versus using our library.
ref.