Skip to content

[local_auth] getAvailableBiometrics does not return "enrolled" biometrics, it returns present hardware on Android #45497

Closed
flutter-team-archive/plugins
#5309

Description

@erdemyerebasmaz

Hello Flutter Team,

Use case

I'd like to enable biometrics authentication on Android if there's enrolled biometrics. As I see it, there's no way to know if there's enrolled biometrics unless you call authenticate method and catch NotEnrolled exception on Android.

/// Indicates the user has not enrolled any fingerprints on the device.
const String notEnrolled = 'NotEnrolled';

I'm assuming enrolled means that the hardware is present and there's at least one configured fingerprint on device according to this comment.

Although, getAvailableBiometrics method is described as:

  /// Returns a list of enrolled biometrics
  ///
  /// Returns a [Future] List<BiometricType> with the following possibilities:
  /// - BiometricType.face
  /// - BiometricType.fingerprint
  /// - BiometricType.iris (not yet implemented)

current getAvailableBiometrics returns the list of present hardware on the device, not enrolled biometrics.

if (Build.VERSION.SDK_INT >= 23) {
   if (packageManager.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT)) {
    biometrics.add("fingerprint");
   }
}

image

Proposal

As a workaround, I encapsulated the part where we populate ArrayList biometrics with

                        ⋮
final BiometricManager biometricManager = BiometricManager.from(activity);
if(biometricManager.canAuthenticate() == BiometricManager.BIOMETRIC_SUCCESS) {
                        ⋮
}
                        ⋮

It serves it purpose well as a workaround but I believe this can result in a false list of biometrics where the device has both fingerprint and face features and only one of them is enrolled.

It would be really great if you could provide a more comprehensive solution to this problem so it returns enrolled biometrics accurately compared to my workaround.

Activity

  1. ben04 commented on Mar 31, 2020

    @ben04

    I'm facing the same problem, a solution would be great!

  2. lzhuor commented on Apr 2, 2020

    @lzhuor

    Facing the same problems.

  3. us3soap commented on Apr 6, 2020

    @us3soap

    Same problems

  4. evelyne24 commented on Apr 7, 2020

    @evelyne24

    The fact this is missing creates a really bad user experience. Since all devices nowadays have biometrics, it feels like a high priority bug to fix.

  5. added
    P2Important issues not at the top of the work list
    and removed
    c: proposalA detailed proposal for a change to Flutter
    c: new featureNothing broken; request for a new capability
    on Apr 2, 2021
  6. stuartmorgan-g commented on Apr 2, 2021

    @stuartmorgan-g
    Contributor

    Marking as a bug, rather than a feature request, since it's inconsistent with the iOS implementation.

  7. Dohmanlechx commented on Jun 9, 2021

    @Dohmanlechx

    I don't mean to be rude, but how come this still is not fixed yet? This is a serious issue, giving the user bad UX while asked to use biometrics when they even haven't enrolled any biometrics in their phones (by that case it's most likely they even don't know about that). We never had these issues until newer versions.

  8. 8 remaining items

  9. mxa0079 commented on Aug 5, 2021

    @mxa0079

    Thanks @stuartmorgan - could we get a commitment to get a timely review of the PR if we do so? Will it get accepted without tests?

  10. stuartmorgan-g commented on Aug 5, 2021

    @stuartmorgan-g
    Contributor

    could we get a commitment to get a timely review of the PR if we do so?

    I can make an effort to prioritize a review; I can't specifically commit to how exactly it will balance against other priorities.

    Will it get accepted without tests?

    No, the contribution guide is very clear about the testing requirements for PRs.

  11. mxa0079 commented on Aug 10, 2021

    @mxa0079

    Hello @stuartmorgan - thanks for your reply.

    Unfortunately, we can´t afford to assign anyone to work on this right away since the team is purely focused on meeting regulatory requirements to meet a government deadline. Especially without having a guarantee from Google that it will be reviewed in a timely manner.

    The issue has been open for almost two years, has lots of comments and upvotes, affects any Android device that has two biometric and fingerprint hardware, and the proposed workaround does not solve the underlying issue. What else is needed to raise the priority of this issue to something above P3?

    Community - please help upvoting this issue and post if this is relevant to you.

  12. stuartmorgan-g commented on Aug 10, 2021

    @stuartmorgan-g
    Contributor

    The issue has been open for almost two years, has lots of comments and upvotes

    Many issues have been open for several years, and many have lots of comments and upvotes. This isn't even in the top 250 issue by votes, to provide some context. We understand that people want this fixed, and we do too, but the same is true of all of those other issues as well. We are prioritizing across a very large workload. We, like you, are engineering-resource constrained.

    What else is needed to raise the priority of this issue to something above P3?

    Flutter's escalation policy for issues is described here: https://github.com/flutter/flutter/wiki/Issue-hygiene#when-will-my-bug-be-fixed

  13. doc-rj-celltrak commented on Sep 1, 2021

    @doc-rj-celltrak

    Slight correction @mxa0079 -- this impacts any Android device with any biometrics support, not just those with two (or more) types of biometrics.

  14. added
    customer: crowdAffects or could affect many people, though not necessarily a specific customer.
    on Oct 21, 2021
  15. HungryBytesApps commented on Jan 7, 2022

    @HungryBytesApps

    Any updates on this? Still facing this problem in 1.1.9. Using a device supporting both finger and face. None of them is set and when running canCheckBiometric and isDeviceSupported they both return true. When running getAvailableBiometrics it returns BiometricType.fingerprint and BiometricType.face. Even when running authenticate inside a try-catch it still crashes. Console gives the error Unhandled Exception: PlatformException(NotEnrolled, No biometrics enrolled on this device., null, null).

  16. darwin-morocho commented on Jan 19, 2022

    @darwin-morocho

    Any updates on this? Still facing this problem in 1.1.9. Using a device supporting both finger and face. None of them is set and when running canCheckBiometric and isDeviceSupported they both return true. When running getAvailableBiometrics it returns BiometricType.fingerprint and BiometricType.face. Even when running authenticate inside a try-catch it still crashes. Console gives the error Unhandled Exception: PlatformException(NotEnrolled, No biometrics enrolled on this device., null, null).

    This PR flutter-team-archive/plugins#4682 should fix this. Now with this PR canCheckBiometrics returns false on Android if device has the biometric hardware but it doesn't have any biometric enrolled.

  17. MingSern commented on Mar 22, 2022

    @MingSern

    Any solution for this? Really need the enrolled biometric value

  18. vigdora commented on Apr 18, 2022

    @vigdora

    any update on this?

  19. github-actions commented on May 6, 2022

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  20. locked as resolved and limited conversation to collaborators on May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High-priority issues at the top of the work listcustomer: crowdAffects or could affect many people, though not necessarily a specific customer.p: local_authPlugin for local authentificationpackageflutter/packages repository. See also p: labels.platform-androidAndroid applications specifically

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions