Setup Firebase phone authentication on ApparenceKit
This guide will help you to install Firebase phone authentication with our app template. By default the phone authentication is generated with the app template. But before you can authenticate with Firebase phone authentication, you need to do some setup.
Phone Authentication seems the best solution but it needs to be used carefully. In some countries SMS are really expensive and some malicious people exploid that. So carefully check SMS prices on the countries you are targeting. I really advise you to also have a secondary way to authenticate your users. (like emails) so you can switch easily if needed.
Activate Firebase phone authentication
- Go to the Firebase Console.
- Select your project.
- Go to the Authentication section.
- Click on the Sign-in method tab.
- Enable the Phone sign-in method.
Android setup
👉 Firebase phone authentication require you to add Play Integrity API or Recaptcha phone-auth#set-up-recaptcha-verification Follow the Firebase documentation to add the Play Integrity API to your Android project.
iOS setup
👉 Firebase phone authentication require you to add a custom URL scheme to your Xcode project.
Follow the Firebase documentation to add the custom URL scheme to your Xcode project.
👉 You also need if that's not already done to add an APN notification key to your Firebase project.
(all the notifications setup are already done in the app template)
You can follow the Setup push notifications with firebase guide to create an APN key.
Link anonymous user to a phone number
By default if you enable the anonymous authentication mode, we will try to link the anonymous user to the phone number. If the phone number is already used, we will login with the phone number.