UNPKG

@earnaha/auth0-action-helper

Version:
26 lines (24 loc) 960 B
/* eslint-disable no-console */ const PreUserRegistrationHelper = require('./pre.user.registration.js'); /** * Handler that will be called during the execution of a PreUserRegistration flow. * * @param {Event} event - Details about the context and user that is attempting to register. * @param {PreUserRegistrationAPI} api - Interface whose methods can be used to change the behavior of the signup. */ exports.onExecutePreUserRegistration = async (event, api) => { try { console.log( 'onExecutePreUserRegistration event=', JSON.stringify(event), ); console.log('onExecutePreUserRegistration api=', JSON.stringify(api)); const helper = new PreUserRegistrationHelper(event.secrets); const res = await helper.exec(event, api); console.log('onExecutePreUserRegistration res=', res); } catch (e) { const errMsg = e?.response?.data || e?.message || `${e}`; console.error('onExecutePreUserRegistration error=', errMsg); throw e; } };