Support Topics Documentation Slack YouTube Blog

Twilio Integration sends code verification on every login

Application ID: 1FD8970D-29A4-9D76-FF5E-678A1A2A5600

The Twilio integration is working as designed for us when I send a user registration with only a phone number, then the Twilio Verification code is sent to that phone number. Then we complete the registration with the transactionId and all is well. Here are the calls we use:

// —> Registering with phone number only:
const verification = await RegistrationService.registerUser({
phoneNumber: RegistrationService.registrationUser.phoneNumber,
});

// —> Completing registration with the transactionCode and the transactionId
registration = await RegistrationService.registerUser({
…RegistrationService.registrationUser,
transactionCode: this.verify,
transactionId: this.transactionId,
});

BUT, now also every time a user logs in the services.Twilio.sendVerificationCode is called for some reason. We don’t need this user to receive a code every time. We only used it during registration to verify the user’s device. Now the user should be allowed to login using only username and password. How do we turn off the Twilio Verification on login?

Here are the logs to document what is happening on login:

Sun Nov 01 2020 15:36:32 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12938] Building ServerCode Model for path (/opt/backendless/repo/1fd8970d-29a4-9d76-ff5e-678a1a2a5600/marketplace/DEPLOYMENT_MODEL/market-B253B45F-B139-A811-FF36-CC35C036DB00)
Sun Nov 01 2020 15:36:32 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12938] ServerCode Model built in 5ms
Sun Nov 01 2020 15:36:32 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12938] [270C6EB3-A840-2299-FF6C-5FD841CB6A00] [INVOKE SERVICE] services.Twilio.sendVerificationCode
Sun Nov 01 2020 15:36:33 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12938] Processing finished in 648.436ms
Sun Nov 01 2020 15:36:31 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12927] Building ServerCode Model for path (/opt/backendless/repo/1fd8970d-29a4-9d76-ff5e-678a1a2a5600/marketplace/DEPLOYMENT_MODEL/market-B253B45F-B139-A811-FF36-CC35C036DB00)
Sun Nov 01 2020 15:36:31 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12927] ServerCode Model built in 6ms
Sun Nov 01 2020 15:36:31 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12927] [52f9d4d6-cff9-4a14-832d-01911104c71c] [INVOKE HANDLER] user.beforeLogin
Sun Nov 01 2020 15:36:33 GMT-0800 (Pacific Standard Time) | SERVER_CODE | INFO | [12927] Processing finished in 1596.103ms

Hello @Justin_Rich

You can disable the event handler “beforeLogin” the Business Logic section. And leave the event for registration only. https://monosnap.com/direct/RiQo7N4Ot83RzXEXlfe3NKiRvhTtOY

Regards,
Inna

Hi Inna, this worked just right. Thank you!