One Tap sign in for Android apps

Tram Ho

Signing in and signing up with One Tap on Android helps you optimize the stream to authenticate users in your app. For many Android applications, user accounts are an important part of the conversion funnel. Users (and developers too!) Often forget the account they have logged into or the password they used for your service. By optimizing the process, you can improve conversion rates and reduce the loss of users from your app.

One Tap creates a simple UI stream for registering or logging in to an application. Just a popup window, select the account you want to link, and the user is authenticated without having to fill in a lot of unnecessary information. Note that for applications that need to use the correct user information, One Tap will not completely replace the existing login or registration flow of the application, it only helps you optimize the user experience. Use in application only.

One Tap supports

  • Log in with an existing account with your service using Google accounts or saved passwords.
  • Register a new account with your service using Google account.

It was released with the library com.google.android.gms:play-services-auth version 18.0.0 .

One Tap and Google Identity Services

One Tap is part of a newly developed library called Google Identity Services . Google Identity Services will eventually incorporate the full feature set of Smart Lock for Passwords and the Google Sign-In library, as well as introduce new features. Google Sign-In allows you to sign in with your Google account (like One Tap ) as well as provide additional features such as the Google Sign-in button and the ability to request additional permissions. However, this is a work in progress and the first version has not implemented the full feature set of these libraries.

One Tap is the first feature of the Google Identity Service that developers are deploying and it is ready to use in existing applications to optimize login and registration flows. Developers will work to add other features provided by Google Sign-In and Smart Lock for Passwords . These include the ability to save passwords, log in using the Google Sign-in button, request access to user data such as drive contents, perform automatic and silent logins with Google Sign-in. , save id credentials and look up phone numbers for automatic streams. Developers hope to launch many of these features in the Google Identity Service later this year.

Compared to the current Google Sign- in and Smart Lock for Passwords UIs , we have found that users are more likely to log in successfully with the One Tap user interface. Additionally, they are more likely to choose the right account when they log back in – this helps them to get into your app, avoiding creating duplicate accounts and cutting down support requests. The web version of this UI, previously launched, has resulted in a doubling of conversions for some websites.

For existing apps, our recommendation is to evaluate adding One Tap to enhance your current login and stream subscriptions that will make sense for your app and team (you don’t need to must be done immediately). Apps that need Google Sign-in or Smart Lock for Passwords features not yet available can use both libraries today to add One Tap to the top of existing streams or wait for support to add later in the year. now on.

For new apps, we recommend using One Tap to create optimized login and sign up experience.

Support login with One Tap

Logging supported with One Tap will show the overlay to users prompting them to log back in with their previously authorized account. The user must log in before it can be displayed as a login option.

One Tap login is activated by your code. Depending on your application, this may be triggered when the application launches for the first time or later when the user tries to perform a protected action.

Once you’ve decided to start the login process, you can query to see if there are any accounts available to log in by calling beginSignIn on SignInClient . For login flows, it is important that you configure your login using setFilterByAuthorizedAccounts(true) to return only previously authorized (or logged in) accounts.

A callback from beginSignIn will send the PendingIntent to show the overlay at launch. Then you call startIntentSenderForResult with the PendingIntent provided to display the login window through the current activity.

The One Tap Dialog can be displayed anywhere in your application. So you can allow users to use your application before asking them to sign in. This allows you to build an optimized login flow for your application. Wherever you call startIntentSenderForResult , the One Tap dialog box will show up on that Activity .

Registration support with One Tap

If One Tap doesn’t find any authorized accounts to log in, beginSignIn will call a failure listener instead of giving the application a PendingIntent . When this happens, you should repeat the query, but this time look for accounts that can be used to register.

This time, configure One Tap with setFilterByAuthorizedAccounts(false) and it will query every valid account that can be used to register, as well as any previously authorized accounts. If any account is found, you will get back the PendingIntent that you can use to display the registration overlay. When prompted to register, users will be asked to agree to share their email and profile rights.

Here is a description of One Tap ‘s workflow:

How to deploy password flow

You can think of signing in passwords with One Tap as a password manager – the login information will be stored and shared with your application just like the user who entered them.

One Tap uses the same password storage mechanism as Autofill and Smart Lock for Passwords . So if a user has ever saved a password in either of these two ways for your app, it will be displayed to the user as an account option on One Tap prompts.

There are three basic password flows: retrieving saved login information, entering new login information and saving new login information .

Retrieve saved login information

In the initial One Tap signup flow, configure beginSignInRequest to support the password. Users will then be provided with any saved passwords as options in the One Tap UI

Login user with password

If the user selects a saved password from the One Tap interface, it will be provided to your application using onActivityResult . After that, you should log in to your backend as usual if the user has entered the password.

If the user does not select an account with One Tap , you can display the usual username / password screen. One Tap doesn’t have an interface to enter a password, so you’ll have to build this screen and log in yourself.

Save the password after logging in

After the user enters the password, prompt the user to save the password using Autofill . The next time the user returns to your app, the saved password will be available as an option in the One Tap login prompt.

Make sure you have optimized your application for Autofill to ensure that Autofill can successfully save your login information! To check the credentials stored in Autofill on the device, install the test Autofill service introduced here – this allows you to ensure that your Autofill deployment will work with all translations. Autofill case .

After you optimize your application for Autofill , you can also consider integrating Smart Lock for Passwords , which gives you more control over saving passwords.

Last words

Visit One Tap documents to learn more about integrating it into your app!

Reference source

Medium

Share the news now

Source : Viblo