Checking the email or phone before sending a verification code
Last updated
var payload = {
identifier: "+12345678910",
identifier_type: "PHONE",
device_type: "BROWSER",
device_name: "Chrome ...",
client_json: { // This is available if you set up AdditionalFields
"name": "Hello World",
"address": "Street Address"
}
};return null;return "Your error message"; const myOnBeginFunction = payload => {
if (payload.identifier != "+12345678910") {
return "Phone Number is not allowed";
}
// No error, continue submission
return null;
} const myOnBeginFunction = async (payload)=> {
try {
let allowed = await checkIfPhoneAllowed(payload.identifier);
if (!allowed) {
return "Phone Number is not allowed";
}
} catch (e) {
return e.message; // Make sure this is a string!
}
// No error, continue submission
return null;
}