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

[local_auth] [android] Non-biometrics authentication gives NotAvailable on Android 10 #147453

Open
ebadta81 opened this issue Apr 27, 2024 · 5 comments
Labels
e: OS-version specific Affects only some versions of the relevant operating system p: local_auth Plugin for local authentification P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team

Comments

@ebadta81
Copy link

What package does this bug report belong to?

local_auth

What target platforms are you seeing this bug on?

Android

Have you already upgraded your packages?

Yes

Dependency versions

pubspec.lock
  local_auth:
    dependency: "direct main"
    description:
      name: local_auth
      sha256: "280421b416b32de31405b0a25c3bd42dfcef2538dfbb20c03019e02a5ed55ed0"
      url: "https://pub.dev"
    source: hosted
    version: "2.2.0"
  local_auth_android:
    dependency: transitive
    description:
      name: local_auth_android
      sha256: e0e5b1ea247c5a0951c13a7ee13dc1beae69750e6a2e1910d1ed6a3cd4d56943
      url: "https://pub.dev"
    source: hosted
    version: "1.0.38"
  local_auth_darwin:
    dependency: transitive
    description:
      name: local_auth_darwin
      sha256: "33381a15b0de2279523eca694089393bb146baebdce72a404555d03174ebc1e9"
      url: "https://pub.dev"
    source: hosted
    version: "1.2.2"
  local_auth_platform_interface:
    dependency: transitive
    description:
      name: local_auth_platform_interface
      sha256: "1b842ff177a7068442eae093b64abe3592f816afd2a533c0ebcdbe40f9d2075a"
      url: "https://pub.dev"
    source: hosted
    version: "1.0.10"
  local_auth_windows:
    dependency: transitive
    description:
      name: local_auth_windows
      sha256: "505ba3367ca781efb1c50d3132e44a2446bccc4163427bc203b9b4d8994d97ea"
      url: "https://pub.dev"
    source: hosted
    version: "1.0.10"

Steps to reproduce

I try to use local_auth with a Zebra TC26BK phone.

At security / screen lock, there are only Swipe, Pattern, PIN and Password options on this phone.

I set my screen lock to PIN method, and tried with Pattern also.

I setup my project with FlutterFragmentActivity() and added android.permission.USE_BIOMETRIC to the manifest, according to the documentation Android Integration section.

auth.canCheckBiometrics works good, gives me FALSE.

auth.isDeviceSupported() returns TRUE, so the queries working good.

But when I try to authenticate, with final didAuthenticate = await auth.authenticate(localizedReason: 'please log in', options: const AuthenticationOptions(biometricOnly: false));, I get PlatformException(NotAvailable, Security credentials not available., null, null).

The PIN screen never appears, and I cannot login with PIN to my application.

I tried with the Plugin example app, and it gives me the same result:
IMG_2712

How can I resolve this problem?

Expected results

Have a PIN screen.

Actual results

No PIN screen appears, only PlatformException(NotAvailable, Security credentials not available., null, null).

Code sample

example code in your repository.

Screenshots or Videos

Screenshots / Video demonstration

[Upload media here]

Logs

Logs

Flutter Doctor output

Doctor output
$ flutter doctor -v
[✓] Flutter (Channel stable, 3.19.6, on macOS 14.4.1 23E224 darwin-arm64, locale en-HU)
    • Flutter version 3.19.6 on channel stable at /Users/developer/Documents/Programming/install/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 54e66469a9 (9 days ago), 2024-04-17 13:08:03 -0700
    • Engine revision c4cd48e186
    • Dart version 3.3.4
    • DevTools version 2.31.1

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/developer/Library/Android/sdk/
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.14.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2023.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)

[✓] IntelliJ IDEA Community Edition (version 2024.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 241.15845

[✓] VS Code (version 1.88.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.86.0

[✓] Connected device (4 available)
    • TC26 (mobile)                        • 20347523020614 • android-arm64  • Android 10 (API 29)
    • Android SDK built for arm64 (mobile) • emulator-5556  • android-arm64  • Android 10 (API 29) (emulator)
    • macOS (desktop)                      • macos          • darwin-arm64   • macOS 14.4.1 23E224 darwin-arm64
    • Chrome (web)                         • chrome         • web-javascript • Google Chrome 119.0.6045.123

[✓] Network resources
    • All expected network resources are available.

• No issues found!
@ebadta81
Copy link
Author

This solution resolved my problem

Could you please put it in the documentation?

@huycozy huycozy added the in triage Presently being triaged by the triage team label Apr 29, 2024
@huycozy
Copy link
Member

huycozy commented Apr 29, 2024

I think this should be fixed on #111025 but I see you are already on the latest package version local_auth_android: 1.0.38.

I checked this again using Android emulator Pixel 3, Android 10 but couldn't reproduce the issue. I see you have two Android 10 devices (from flutter doctor output). Could you confirm this occurs on both your physical device and emulator?

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Apr 29, 2024
@ebadta81
Copy link
Author

ebadta81 commented May 1, 2024

In emulator, it does not occurs, because it has fingerprint biometric sensor. Also my zebra phone have android 10 build number: 10-16-10.00-QG-U00-STD-HEL-04, maybe it is not the same in emulator.

It is pretty clear to me, this is an android bug they already fixed with this jetpack package.

Fixed an issue where BiometricManager.canAuthenticate(int) would sometimes return the wrong status code for a device with a fingerprint sensor on Android 10 (API level 29). ([I72420](https://android-review.googlesource.com/#/q/I72420b5721ea41bae8b037f43ab8fbd49250ebf2), [b/176921662](https://issuetracker.google.com/issues/176921662))
Fixed an issue where BiometricManager.canAuthenticate(int) would return the wrong status code for a device with no biometric hardware and no enrolled PIN, pattern, or password on Android 10 (API level 29) and prior SDK versions. ([I79b7d](https://android-review.googlesource.com/#/q/I79b7dbf009c44582c4693be5d27dd850777ab4d1), [b/174505824](https://issuetracker.google.com/issues/174505824))

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label May 1, 2024
@huycozy
Copy link
Member

huycozy commented May 2, 2024

Thanks for checking emulator and quoting the related change of version androidx.biometric:biometric:1.2.0-alpha02. I don't have such an Android 10 physical device to check this but I think this is a valid issue. Perhaps we can just roll into new package version once biometric dependency releases stable version. Labeling this for other's thoughts.

@huycozy huycozy added platform-android Android applications specifically p: local_auth Plugin for local authentification package flutter/packages repository. See also p: labels. e: OS-version specific Affects only some versions of the relevant operating system team-android Owned by Android platform team fyi-ecosystem For the attention of Ecosystem team and removed in triage Presently being triaged by the triage team labels May 2, 2024
@stuartmorgan stuartmorgan added the triaged-ecosystem Triaged by Ecosystem team label May 8, 2024
@flutter-triage-bot flutter-triage-bot bot removed fyi-ecosystem For the attention of Ecosystem team triaged-ecosystem Triaged by Ecosystem team labels May 8, 2024
@reidbaker
Copy link
Contributor

Current status is we think that the issue is with the underlying biometrics androidx implementation. We are working on figuring out when their next stable release will be and leaving this bug open to track updating the dependency.

@reidbaker reidbaker added P2 Important issues not at the top of the work list triaged-android Triaged by Android platform team labels May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e: OS-version specific Affects only some versions of the relevant operating system p: local_auth Plugin for local authentification P2 Important issues not at the top of the work list package flutter/packages repository. See also p: labels. platform-android Android applications specifically team-android Owned by Android platform team triaged-android Triaged by Android platform team
Projects
None yet
Development

No branches or pull requests

4 participants