Skip to content

Instantly share code, notes, and snippets.

@dnationalwala-pm
Last active October 25, 2023 15:02
Show Gist options
  • Save dnationalwala-pm/f03704161b718432bb4f787583653800 to your computer and use it in GitHub Desktop.
Save dnationalwala-pm/f03704161b718432bb4f787583653800 to your computer and use it in GitHub Desktop.
/**
* Handler that will be called during the execution of a PostUserRegistration flow.
*
* @param {Event} event - Details about the context and user that has registered.
* @param {PostUserRegistrationAPI} api - Methods and utilities to help change the behavior after a signup.
*/
exports.onExecutePostUserRegistration = async (event, api) => {
const ManagementClient = require('auth0').ManagementClient;
const management = new ManagementClient({
domain: event.secrets.domain,
clientId: event.secrets.clientId,
clientSecret: event.secrets.clientSecret,
});
var params = { id: event.user.user_id };
console.log('params >>>> ', params);
var metadata = {
address: '123th Node.js Street'
};
management.updateUserMetadata(params, metadata, function (err, user) {
if (err) {
console.log(err);
}
// Updated user.
console.log('user: ??? ', user);
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment