How to set up phone number authorization (OTP)?
This section contains information for setting up authorization using a phone number (checking a phone number using SMS). Information for Web, Android and iOS.
If the project does not have a website (web version for users), then steps 1, 4, 5, 6 and 7 can be skipped
1.) If the project has a website for users - your site must have Google reCAPTCHA configured: https://ifsoft.co.uk/help/how_to_add_google_recaptcha_v3_to_you_site/
2.) You must have a ready-made project in Firebase Console and your project (Android, iOS and web applications) must be configured to work with FCM (Firebase Cloud Messages): https://ifsoft.co.uk/help/how_to_create_fcm/
3.) go to https://console.firebase.google.com/ and select you firebase project
4.) Click + to
![How to set up phone number authorization (OTP)](otp_1.png)
5.) Click (<\>) icon to add Web project
![How to set up phone number authorization (OTP)](otp_2.png)
6.) Enter you Web Project name (1) and click "Register app" button (2)
![How to set up phone number authorization (OTP)](otp_3.png)
7.) Select and copy js code fragment (see screenshot) to file "js/firebase/config.js"
![How to set up phone number authorization (OTP)](otp_4.png)
8.) Go to "Authentication" section (1) in you firebase project, select "Sign-in method" tab (2), click item "Phone" (3),
switch to "Enable" (4), you can add phone number and sms code to test (5), and click "Save" (6)
![How to set up phone number authorization (OTP)](otp_5.png)
9.) Click gear icon (1) and select "Project settings" menu item (2)
![How to set up phone number authorization (OTP)](otp_6.png)
10.) Click "Service accounts" tab (1) and select item "Firebase admin SDK" (2), click "Create service account" (3)
![How to set up phone number authorization (OTP)](otp_7.png)
11.) Click "Generate new private key" button (1)
![How to set up phone number authorization (OTP)](otp_8.png)
12.) Click "Generate key" button and downloaded json file copy to you server side folder "js/firebase/"
![How to set up phone number authorization (OTP)](otp_9.png)
13.) To set up OTP in an iOS application, you need to set up Google reCAPTCHA, see the screenshot from the official Firebase documentation and follow the instructions
![How to set up phone number authorization (OTP)](otp_10.png)
14.) All. Test. If you did everything right, you shouldn't have any problems. For testing purposes, I recommend adding the number and verification code as shown in step 8, because Firebase does not allow very many requests to be sent from one device.