rushisangani / BiometricAuthentication

Use Apple FaceID or TouchID authentication in your app using BiometricAuthentication.
MIT License
831 stars 110 forks source link

How to force set TouchID over FaceID usage? #6

Closed hemangshah closed 7 years ago

hemangshah commented 7 years ago

I am now using BiometricAuthentication in my app. And right now, I don't have an iPhone X device to test this. So is there a way that I can tell BiometricAuthentication to use TouchID only? Or in other words, I don't have a requirement to use FaceID as of now so want to use their TouchID only.

rushisangani commented 7 years ago

Hi @hemangshah you should support both Face ID and Touch ID, because you never know in which device your app is installed. Your app must support all iPhones right?

You can test Face ID from simulator. Install XCode 9.1 or above 9.0 Run your app in iPhone X, there you've an option in Hardware -> Face ID.

You need to first enrol Face ID, then you can check for matching and non-matching Face ID.

Hope you got my point.

hemangshah commented 7 years ago

Yes, you're right. iPhone X doesn't have a TouchID anymore.

Panajev commented 7 years ago

It is the app’s responsibility not to use one or the either for now. The iOS framework will tell you if the device has either TouchID or FaceID available as biometric authentication methods and you can just branch on that and disable your Fingerprint login code/revert back to username and password if you do wish.

It would help if you summarised why you are trying to do that and what is the use case for it.

Sent from my iPhone

On 7 Nov 2017, at 08:58, Hemang notifications@github.com wrote:

Yes, you're right. iPhone X doesn't have a TouchID anymore? Instead, they have introduced a FaceID.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

hemangshah commented 7 years ago

How can I check whether the device doesn't have a Touch ID feature using this library? @rushisangani

rushisangani commented 7 years ago

You should check using the following, which is mentioned in the document. if BioMetricAuthenticator.canAuthenticate() { // Touch id or face id is available and in the valid state }

hemangshah commented 7 years ago

@rushisangani, if .canAuthenticate() is true meaning user has set either TouchID or FaceID in his iPhone?

rushisangani commented 7 years ago

Nope. It just states that your app can use biometric authentication either face id or touch id. Once you try to authenticate you'll get an error if the user has not registered the touch id or face id.

There are various reasons for authentication can fail. Please check for Error Handling section in the document.

Panajev commented 7 years ago

If you want to detect whether Face ID or Touch ID is used you can refer to the following enum

https://developer.apple.com/documentation/localauthentication/labiometrytype

https://developer.apple.com/documentation/localauthentication/lacontext/2867583-biometrytype

I would suggest a generic copy text for the pop up and let Apple handle the rest. BTW, be sure to declare the following entry in the plots if you want FaceID to work when you develop against the iOS 11 SDK:

https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW75

Sent from my iPhone

On 7 Nov 2017, at 10:32, Rushi Sangani notifications@github.com wrote:

Nope. It just states that your app can use biometric authentication either face id or touch id. Once you try to authenticate you'll get an error if the user has not registered the touch id or face id.

There are various reasons for authentication can fail. Please check for Error Handling section in the document.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.