// This is Sample login script for Enterprise Custom Database Connection in auth0 - to lookup user Profile details from some external Database async function login(email, password, callback) { let authenticateCallHeaders = {}; let emailPwdStr = ""; await axios.post( configuration.authdb_api_uri, emailPwdStr, authenticateCallHeaders) .then(function (response) { console.log("API call was a success, logged in user:", email); let profile = { 'blocked': response.data.disabled, 'user_id': response.data.id, 'name': response.data.name, 'email': response.data.email, 'phone_number': response.data.phone_number, 'created_at': response.data.ctime, 'user_metadata': { 'locale': response.data.locale, 'zoneinfo': response.data.timezone }, // XXX This value is not synced to user Profile > Raw Json "multifactor": ['guardian'], // XXX This value is sync to User Profile > Raw Json but does not trigger MFA - Also not visible on User Profile Section "mfa_factors": [ { "totp": { "secret": response.data.usermfa.secret } } ] // XXX guardian_authenticators is not synced to user Profile > Raw Json // ,"guardian_authenticators": [ // //{ // // "id": "totp|dev_shshshk", // // "type": "totp", // // "confirmed": true, // //"created_at": "2023-06-05T13:00:33.000Z", // //"last_auth_at": "2023-06-05T13:02:47.000Z" // //} // { // "type": "totp", // "name": "OTP Application", // "totp_secret": response.data.usermfa.secret // } // ] }; return callback(null, profile); }) .catch(function (error) { console.error(" API failed with error: ", error); return callback(new Error(email, " API failed with error:" + error)); }); }