Skip to main content

Password Autofill in iOS 11

Password Autofill








9to5mac.com
As a user, we have many applications installed on our devices and most of them have a login feature.
Logging in is the first step that a user has to take when they start with an app that requires an account. This usually takes a couple of seconds if the user remembers their credentials and is able to type them right away. Many users, instead, use the password manager service like iCloud Keychain1PasswordLastPassNortonIDSafe etc. and copy their username and password.
Many of the applications have the same username and password as we use the email address as our login name and to keep it simple to remember the password we usually have a tendency to have the same password for more than one application or we have set of passwords which we use for all the application for example.
Username: santosh@gmail.com
FB Password: P@ssword
Email Password: P@ssword
I know, every account should have unique/different password, security loophole, risky and blah… blah… blah…
It is what it is. 🙄 🙄 🙄

Now the point is what to do now?
Apple has introduced a very basic but important feature at WWDC 2017 that many of us wanted to have.
In iOS 11, Apple has introduced a seamless way to streamline the login process with the new Password AutoFill API.
This is a very easy and faster way for users to login and developers to implement for their applications.
In this blog, we will be going through a step by step to have it in our application.

Preparing your App for AutoFill

There are two scenarios which we can handle to use the AutoFill in our application.
  • QuickType bar just above the keyboard with the key symbol.
  • Link our website and application which will directly show the exact user name and password combination for your application.
Let’s walk through both the scenarios one by one.
# QuickType Bar
Showing the password button is as simple as changing one setting on your text fields.
userNameTextField?.textContentType = .username
passwordTextField?.textContentType = .password
That’s it, and you are done.
Run your application and tap on the userNameTextField or passwordTextField it will show you the keyboard.




Wait, there is simple change when you see the keyboard now compare to the keyboard which you were using previously.
🔑 at right top of the keyboard.
Tap on 🔑.


Asking for your TouchID.. Ya.. safety :)

It will present a list of username & passwords available in the default password manager.



Tap on any one of them and it will auto fill your username and password text field.



NOTE: I kept the password field as a plain text field intentionally.
Feeling great, right? Wait a minute. What if you want to sign up? Only username & password will not suffice your needs.
UITextContentType has many other semantic meanings expected for a text field like from iOS 10.
emailAddress, countryName, creditCardNumber and many more.
Get the entire list here.
UITextContentType like username & password are introduced in IOS 11.

Our applications will get the list of username & password combinations, but from where?
🤔 🤔 🤔 Good question.
iOS and Mac OS have a password manager inbuilt and integrated in Safari.
Whenever user login to any site using Safari it prompts user for saving a password.


Safari Save Password Prompt

I understand, in the above scenario it shows all the username/password combination to fill in.
But, I am very sure that, user has logged into my site and has saved the credentials in the safari password manager?
That means, instead of showing list of username/password can my application show my site/app specific username & password. User just tap on key and we are done.
YES, We can do this.
😊 😊 😊 Thanks to Apple.

# Associating your specific app password

In iOS 11, application & sites can have the association.
Let’s understand how to do the association of application and website.
To establish the association between our application and our website we require a file called apple-app-site-association.
It might be familiar to you, If you have supported the deep-linking or universal linking to iOS users can tap a link to your website and get seamlessly redirected to your installed app without going through Safari. If your app isn’t installed, tapping a link to your website opens your website in Safari.
If not, don’t worry. It’s not required here.
If your app doesn’t have deep-linking, you’ll need to enable Associated Domains in your Xcode project.
Switch to your Xcode project settings, go to the Capabilities tab, and turn on Associated Domains.


Project capabilities

Add your website URL here. Let’s say your website domain name is santoshbotre.com: the listed domain name should be,
webcredentials:santoshbotre.com
webcredentials:[listed_domain_name]
You can have multiple domain association for your application.
On you server, add an apple-app-site-association file, or extend your current one, if present. It should contain a webcredentials section that specifies your app.
Here’s an example:
{
     "webcredentials": {
            "apps": [A6411SB83A.com.santoshbo.PasswordAutoFill]
     }
}
A6411SB83A.com.santoshbo.PasswordAutoFill is application bundle id.
Apple recommends adding this file to the /.well-known directory, but you may also use the root. The full path will look like this:
Your application is ready for AutoFill will association with your site. Isn’t it simple.
Build and run your app on a device running iOS 11 (this functionality is not available in the simulator).
You will able to see the,


Associated Password Autofill

If you want to know more about Password AutoFill, check out Session 206 at WWDC 2017

Comments

Popular Posts

How I Reduced the Size of My React Native App by 85%

How and Why You Should Do It I borrowed 25$ from my friend to start a Play Store Developer account to put up my first app. I had already created the app, created the assets and published it in the store. Nobody wants to download a todo list app that costs 25mb of bandwidth and another 25 MB of storage space. So today I am going to share with you how I reduced the size of Tet from 25 MB to around 3.5 MB. Size Matters Like any beginner, I wrote my app using Expo, the awesome React Native platform that makes creating native apps a breeze. There is no native setup, you write javascript and Expo builds the binaries for you. I love everything about Expo except the size of the binaries. Each binary weighs around 25 MB regardless of your app. So the first thing I did was to migrate my existing Expo app to React Native. Migrating to React Native react-native init  a new project with the same name Copy the  source  files over from Expo project Install all de...

How to recover data of your Android KeyStore?

These methods can save you by recovering Key Alias and Key Password and KeyStore Password. This dialog becomes trouble to you? You should always keep the keystore file safe as you will not be able to update your previously uploaded APKs on PlayStore. It always need same keystore file for every version releases. But it’s even worse when you have KeyStore file and you forget any credentials shown in above box. But Good thing is you can recover them with certain tricks [Yes, there are always ways]. So let’s get straight to those ways. 1. Check your log files → For  windows  users, Go to windows file explorer C://Users/your PC name/.AndroidStudio1.4 ( your android studio version )\system\log\idea.log.1 ( or any old log number ) Open your log file in Notepad++ or Any text editor, and search for: android.injected.signing and if you are lucky enough then you will start seeing these. Pandroid.injected.signing.store.file = This is  file path where t...

React Native - Text Input

In this chapter, we will show you how to work with  TextInput  elements in React Native. The Home component will import and render inputs. App.js import React from 'react' ; import Inputs from './inputs.js' const App = () => { return ( < Inputs /> ) } export default App Inputs We will define the initial state. After defining the initial state, we will create the  handleEmail  and the  handlePassword  functions. These functions are used for updating state. The  login()  function will just alert the current value of the state. We will also add some other properties to text inputs to disable auto capitalisation, remove the bottom border on Android devices and set a placeholder. inputs.js import React , { Component } from 'react' import { View , Text , TouchableOpacity , TextInput , StyleSheet } from 'react-native' class Inputs extends Component { state = { ...