okta / samples-ios

samples-ios
https://github.com/okta/samples-ios
Apache License 2.0
39 stars 27 forks source link

Biometrics Not Working #102

Open mdhornet90 opened 2 years ago

mdhornet90 commented 2 years ago

Describe the bug?

I'm attempting to use the iOS SDK to enable biometric login and it always prompts me for my passcode instead of FaceID.

What is expected to happen?

The call to secureStorage.getData prompts for FaceID to unlock the phone

What is the actual behavior?

The call to secureStorage.getData prompts me for my passcode to unlock the phone

Reproduction Steps?

  1. Add a new line of code on line 72 of SignInViewController: print(self.secureStorage.isTouchIDSupported() || self.secureStorage.isFaceIDSupported())
  2. Install the OktaSignInAndStorage project on your phone
  3. Sign into your Okta tenant, verify that "true" is printed in the console
  4. Tap on "tokens", a view that should retrieve secure storage leveraging biometrics.

Additional Information?

No response

SDK Version(s)

okta-storage-swift@master okta-oidc-ios@master

Build Information

Xcode version: 13.3 (13E113) iPhone 12, v15.4.1

mdhornet90 commented 2 years ago

Stumbled on this SO answer: https://stackoverflow.com/a/46853211/1061011

And sure enough adding even a blank value for the key NSFaceIDUsageDescription in Info.plist allows the app to prompt for FaceID before falling back to the passcode. Is there a reason this isn't included in the sample?

emanor-okta commented 2 years ago

I needed to add an entry in Info.plist as well.

dawoudt-okta commented 2 years ago

This was the issue for me as well, perhaps this should be documented in the appropriate repo