“Imagine you have an amazing app in the market. You are really excited to test it and use it for simplifying life. You just downloaded the app. The colorful intro screens only add to your expectations. Finally, you end up on the login screen. You now want to login to the app. You type in your email and password. But, oh! You have entered an invalid password. No issues! You have a cool option to reset your password. You went to the reset password option and again you had to enter your email address. Congratulations, you have successfully reset your password. Now, you again open the app and you see the login screen. Again, you are asked to enter your credentials. Well! I am sure, by now, you are annoyed! I hope you are not planning to uninstall the app….. 🙁 ”
In real world, every user wants things to be done quickly. Auto-correction and auto-fill are examples of such utilities that make things convenient for the user. Similarly, login credentials too can be auto filled into the required fields to make login quicker and more convenient for the user. For this, Android offers smart lock feature. By integrating Smart Lock for Passwords into your Android app, you can automatically sign users in to your app using the credentials they have saved. Users can save both username-password credentials and federated identity provider credentials.
After users successfully sign in, create accounts, or change passwords, they can be allowed to store their credentials to automate future authentication in the app.
Step – 1 : Create a Credential object containing a user’s sign-in information.
Step – 2 : Call CredentialsClient.save() to save users’ credentials.
Note: This call might not be immediately successful. If this is the case, then it means the credentials might be new. In this case, the user must confirm the save request. Thus, Resolve the ResolvableApiException with startResolutionForResult() to prompt the user for confirmation.
If the user chooses not to save credentials, the user won’t be prompted again to save any account’s credentials for the app. If the CredentialsClient.save() is called after a user has opted out, its result will have a status code of CANCELED.
If the user wants to save the credentials at some point of time in future then s/he can opt in later from the Google Settings app, in the Smart Lock for Passwords section. Now, the user must enable credential saving for all accounts to be prompted to save credentials next time.
After storing, the credentials can be retrieved by calling CredentialsClient.request()
In this way, you can store user’s credentials to auto fill the credentials on the login screen. This saves user’s time and adds to the user experience. This will also be implemented in SUSI.AI alongwith an improved auth flow for a better user experience.
- Smart lock for passwords on Android