Over 90% of people who have issue login into an app is going to leave. Sign-in is such an important part of your growth funnel. Using phone number as an effective identity for authentication.
People prefer to use their phone as their identity instead of an email address or another form of identification. Phone numbers are higher quality.
Firebase Phone Auth
Many apps that actually don’t have phone number authentication today, building it in the first place can be a real struggle.
Firebase allow is it enables basic sign-in and sign-up flows. On Android Firebase actually, allow a few and built-in enhancements. Firebase has a really new cool piece of functionality called instant verification on Android.
Firebase enables basic sign-in and sign-up flows.
All a user would need to do is enter their phone number, and you can go ahead and pass it over to Firebase.
Firebase will validate the phone number, handle any normalization logic that needs to happen, if this is a new user, or a returning one, and go ahead and generate a one-time code associated with this request.
The new user will simply pass back the code into your application, and which you would just pass right back on to Firebase, and Firebase will verify it. Firebase will handle any of the complex logic, and deduplication, if you send multiple SMS by mistake or any of the other edge cases that might arise. The user will go ahead and enter their code. Firebase will validate it. Firebase will go ahead and mint cryptographically signed tokens, persist sessions the whole authentication. You won’t have to worry about how any of it.
The best part of all of this is your user never actually had to leave your application, go to an SMS tab, wait for it and then copy and paste the code into your UI. They stayed in your application the entire time. It’s a really seamless experience for them overall. That’s all that you ever to do. All this powerful functionality is also really easy to use.
As a pre-requisite, ensure your application is configured for use with Firebase.
Then, add the FirebaseUI auth library dependency. Please check the latest version
The second thing you need to do is just enable phone auth within your project in the Firebase console.
It’s really easy to use. In order to get all the awesome functionality the actual ability to generate and send codes, the auto-retrieval, even instant verification, comes down to just one single API call, and the implementation of the callbacks that you care about.
What’s about UI?
Building authentication UI can be pretty complex.FirebaseUI wrote out all the code for different phone authentication flows that.
The first thing you’ll notice is Firebase UI integrates with hint selector directly. You didn’t write any additional code for this. It’s able to pick up user’s phone number from the device, and I can just simply enter it directly into the app.
Now when you hit verify phone number, it’ll go ahead and send a code which will directly get right off the SMS. The code was sent to your device immediately written from the SIM. All I did was really tap my phone number and everything else was taken for me. The SMS was delivered. It was passed. It was taken. I never left the app.
Instant verification checks if firebase has verified this phone number on the device recently. If it has, it can actually instantly verify the phone number the next time around without needing to send any additional SMS. It thinks that this means there is no wait time, on SMS, or anything else, just pure simplicity verify.