Getting Started with Touch ID & Local Authentication
A tutorial on authenticating a user with their fingerprint in iOS 8
Welcome to the future!
We can now sign in to our banks, social networks, and other apps with our fingers. This is the stuff of science fiction!
Touch ID was built into the iPhone 5S that was released in September 2013. At the Apple WWDC (World Wide Developer Conference) they announced that developers could now use Touch ID in their apps.
As you may remember, some developers looked into the private frameworks in iOS 7 and found a framework called BiometricsKit. This got us developers giddy with anticipation, hoping and praying for third party access.
Introducing LocalAuthentication.framework. This is the framework that allows you to authenticate with TouchID (and potentially other types of local authentication). The basic process for requesting authentication is as follows:
- Create a Local Authentication Context (LAContext)
- Create a Local Authentication Policy (LAPolicy) and specify what type of authentication you want (LAPolicyDeviceOwnerAuthenticationWithBiometrics)
- Use the context to evaluate the policy and receive either a success or failure.
Enough of boring lists, lets look at the code!
Simple, sweet, and secret agent-y. Now you can use your thumb to access all your personal data. I have open sourced our implementation and provided it as a CocoaPod. The github repo contains a Swift && Objective C version of the project.
CocoaPod : “ pod ‘EHFAuthenticator-Touch-ID’ ”
Here at eHarmony, we are implementing a privacy feature allowing you to hide your hot dates behind a Touch ID security wall. You can see the rough mock ups below:
We are super excited about iOS 8 and all the new features. eHarmony is going to have an exciting iOS 8 release that will hopefully make users feel safer and happier!