Fetching a one-time password for an app on Android

by: Elliot Tormey

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

We built a product in a lockdown

At the start of the lockdown, around March last year, I have to admit a case of the jitters. I was prospecting on five different projects. Some with existing clients, some with new clients. Our order book was good - but we always have to have an eye on up coming...

read more
The Rise of the Super App

The Rise of the Super App

Imagine being able to chat with your friend through instant messaging, then book dinner, a movie or a gig and pay for everything all from one single app. That’s the power of a super app.  Mobile users worldwide have dedicated apps for specific tasks. This is not...

read more

0 Comments