Hi,
I need to retrieve user metadata on “Post Change Password” action. Docs says user_metadata can not be retrieved using event.user.user_metadata. So i am planning to use mgmt API and pass user_id to getUser API. With the response from getUser i am planning to retrieve user_metadata attribute. I have the following code which is not working.
const { ManagementClient } = require('auth0');
exports.onExecutePostChangePassword = async (event) => {
try {
const auth0 = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientID,
clientSecret: event.secrets.clientSecret,
});
const user_id = event.user.user_id
const user = await auth0.getUser({ id: user_id });
console.log('User Details:', user);
} catch (err) {
console.log(`Error sending email to ${event.user.email}:`, err.message)
}
};
But when testing in actions page, i get this error
auth0.getUser is not a function
Any suggestions?