I have to authenticate phone number using firebase otp in my NodeJS express API . I'm already using mongo dB for storing data also i need to add firebase . how i add firebase to my NodeJS app and send otp to that number .
Asked
Active
Viewed 2,992 times
1 Answers
4
There is no method in Firebase Admin SDK to send verification SMS. Only the users (using Client SDK) can request it. You would have to implement a custom auth flow if you want to send SMS from your server and send messages yourself using services like Twilio.
It's more like having a custom authentication system but then you use Custom Tokens to login user using Firebase after you've authenticated them.
To summarize the auth flow:
- Send SMS to user from your server (and store the code in database)
- When user enters the code, verify it and generate a custom token using Admin SDK
- Send the custom token back and log in user using Firebase

Dharmaraj
- 47,845
- 8
- 52
- 84