Adding 2FA to a React App Using Firebase Function
The author built a tool in Firebase to control smart devices using text messages and voice commands, with the help of the Verify API from Vonage. To start, they created a virtual phone number and set up a Cloud Function to send verification codes to users when their numbers are added to Firestore. The function uses the Nexmo JavaScript SDK wrapped as promises to handle callback methods correctly. After receiving a verification code, users can submit it to check if it's valid, and if so, update the document in Firestore with a verified flag. The author also built a React app to add new phone numbers and verify them using Firebase Functions. With the Verify API, they gained control over how their system interacts with users, protecting against spam and suspicious activity while validating ownership of phone numbers.
Company
Vonage
Date published
May 18, 2021
Author(s)
Kelly J Andrews
Word count
1322
Language
English
Hacker News points
None found.