Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LocalAuthentication.hasHardwareAsync() returns false on iPhone 13 Pro if FaceID permission was canceled #28840

Open
dziter opened this issue May 14, 2024 · 0 comments
Labels
needs review Issue is ready to be reviewed by a maintainer

Comments

@dziter
Copy link

dziter commented May 14, 2024

Minimal reproducible example

https://github.com/dziter/expo-local-auth/tree/feat/expo-local-authentication

What platform(s) does this occur on?

iOS

Did you reproduce this issue in a development build?

No (only happens in a standalone build)

Summary

To reproduce:

On the minimal reproducible example, on iOS with a device supporting FaceID/TouchID, please do:

1 - Click on 'Check Hardware'
2 - Click on 'Check Enrollment'
3 - Click on 'Authenticate'
4 - Click on 'Cancel' when the iOS permission for FaceID/TouchID is shown
5 - Click on 'Check Hardware' // await LocalAuthentication.hasHardwareAsync() returns false

Expected:
await LocalAuthentication.hasHardwareAsync(); should return true (independently of the permission choice made by the user for authenticateAsync on step 4).

If it can help, I think the library works as expected when the FaceID/TouchID permission is not shown but instead the passcode, meaning when this permission is not in the Info.plist:
<key>NSFaceIDUsageDescription</key>


More details for our production use case:
1 - Check if the user device supports biometry:
await LocalAuthentication.hasHardwareAsync() && await LocalAuthentication.isEnrolledAsync()

2 - The user requests to enable biometry:
await LocalAuthentication.authenticateAsync();

3 - The user clicks on Cancel when the iOS permission is shown
const result = await LocalAuthentication.authenticateAsync(); console.log(result); //will be: {"error": "not_available", "success": false, "warning": null}

4 - We want to show a switch 'Enable Biometry' when the user did not enable biometry but the device has the hardware capability/
Issue: await LocalAuthentication.hasHardwareAsync(); returns false

Environment

expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 21.6.2 - ~/.nvm/versions/node/v21.6.2/bin/node
Yarn: 4.2.2 - ~/.yarn/bin/yarn
npm: 10.2.4 - ~/.nvm/versions/node/v21.6.2/bin/npm
Watchman: 2023.09.25.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4
Android SDK:
API Levels: 26, 27, 28, 29, 30, 31, 32, 33, 34
Build Tools: 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 32.0.0, 33.0.0, 33.0.0, 33.0.1, 34.0.0, 35.0.0
System Images: android-32 | Google APIs ARM 64 v8a, android-32 | Google Play ARM 64 v8a, android-32 | Google Play Intel x86 Atom_64
Android NDK: 22.1.7171670
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.11005911
Xcode: 15.3/15E204a - /usr/bin/xcodebuild
npmPackages:
expo: ^51.0.0 => 51.0.5
react: 18.2.0 => 18.2.0
react-native: 0.74.1 => 0.74.1
Expo Workflow: bare

Expo Doctor Diagnostics

✔ Check Expo config for common issues
✔ Check package.json for common issues
✔ Check dependencies for packages that should not be installed directly
✔ Check for common project setup issues
✔ Check for issues with metro config
✔ Check npm/ yarn versions
✔ Check Expo config (app.json/ app.config.js) schema
✔ Check that packages match versions required by installed Expo SDK
✔ Check native tooling versions
✔ Check for legacy global CLI installed locally
✔ Check that native modules do not use incompatible support packages
✔ Check that native modules use compatible support package versions for installed Expo SDK

@dziter dziter added the needs validation Issue needs to be validated label May 14, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants