@earnaha/auth0-action-helper
Version:
AHA auth0 action helper
23 lines (21 loc) • 854 B
JavaScript
/* eslint-disable no-console */
const PostLoginHelper = require('./post.login.js');
/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
try {
console.log('test-onExecutePostLogin event=', JSON.stringify(event));
console.log('onExecutePostLogin api=', JSON.stringify(api));
const helper = new PostLoginHelper(event.secrets);
const res = await helper.exec(event, api);
console.log('onExecutePostLogin res=', res);
} catch (e) {
const errMsg = e?.response?.data || e?.message || `${e}`;
console.error('onExecutePostLogin error=', errMsg);
throw e;
}
};