Fetching a one-time password for an app on Android

Are you looking to implement a one-time password (OTP) functionality in an Android app?

Android Developers have shared a handy new way to do this.

By using the SMS User Consent API you can prompt your users to share a single SMS message containing a one-time password. This means your app can now do SMS verification without asking for permission to read every single SMS message.

The API shows the user a prompt asking them if they want to share a single SMS message with your app. If the user accepts, the message will be shared with your app.

The new SMS User Consent API is making it a lot simpler. By using the API it prompts the user for permission to read that one text with the one-time password code. Once the user gives consent the app will have access to the entire message body to automatically complete SMS verification.

A previous way of doing this was to have a backend implementation in-between to authenticate the message and get the code, but this new way gives you temporary access to the user’s messages. It then forwards that message to the app and lets you parse it manually.

You can also use the SMS retriever API for the same user flow. It creates a better user experience as the user won’t be prompted. You just have to modify the SMS message to allow it to be automatically forwarded to your Android app.

Check out the video below from Android Developers on how to start using the API.

You May Also Like

Clutch Names Tapadoo Top B2B App Development Company

Clutch Names Tapadoo Top B2B App Development Company

The first line of the latest Business Post article on Tapadoo reads; 'Dermot Daly started creating apps for fun in 2009. Ten years on, his company employs 25 people. What may have started as fun has turned into a team of 25, dedicated to the pursuit of mobile app...

read more
Do you have an app idea? Read this

Do you have an app idea? Read this

We don’t like to burst any bubbles here in Tapadoo, but at the same time, we get a lot of enquiries from people who have an ‘app idea’. As exciting as this may seem….we need to be clear with you about what’s involved in developing an app. This isn’t to put you off...

read more

0 Comments