Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

getCredentials fails on an unrecognized fingerprint while the biometric prompt is still open

Đã đóng Phù hợp với người mới
#1,095 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
authentication, mobile

Hướng nghiên cứu

Bắt đầu từ auth0/src/main/java/com/auth0/android/authentication/storage/LocalAuthenticationManager.kt tại onAuthenticationFailed(), hiện đang gọi resultCallback.onFailure(BIOMETRICS_INVALID_USER). So sánh với onAuthenticationSucceeded() và onAuthenticationError(), là các hàm trả về kết quả cuối cùng. Tìm các unit test hiện có cho manager này và chạy chúng. Hoàn thành khi một lần thất bại chưa phải là cuối cùng không báo cáo gì, và callback nhận đúng một kết quả khi hộp thoại xác thực đóng lại.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Checklist
  • The issue can be reproduced in the Auth0.Android sample app (or N/A).
  • I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
  • I have looked into the API documentation and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.
Description

SecureCredentialsManager.getCredentials() with local authentication fails as soon as one fingerprint is not recognized, while the biometric prompt is still open.

LocalAuthenticationManager.onAuthenticationFailed() calls resultCallback.onFailure(CredentialsManagerException.BIOMETRICS_INVALID_USER):

https://github.com/auth0/Auth0.Android/blob/3.21.1/auth0/src/main/java/com/auth0/android/authentication/storage/LocalAuthenticationManager.kt#L79-L82

BiometricPrompt calls onAuthenticationFailed() when a biometric is read but not recognized. It is not a final result. The prompt stays open, so the user can try again or use the device credential fallback. The final result always comes later through onAuthenticationSucceeded() or onAuthenticationError().

Because of this the callback gets onFailure(BIOMETRICS_INVALID_USER) first and then, when the user does unlock, onSuccess. SecureCredentialsManager also calls updateBiometricSession() on that later success. So the session starts, but a caller that settles on the first result never sees it. That is what happens in react-native-auth0, where the first result rejects the JS promise and the later success is dropped.

Expected: onAuthenticationFailed() does not report anything, and the callback gets one result once the prompt closes.

The same applies to getApiCredentials(), which uses the same LocalAuthenticationManager.

Reproduction
  1. Configure SecureCredentialsManager with LocalAuthenticationOptions, deviceCredentialFallback = true and BiometricPolicy.Session.
  2. Call getCredentials().
  3. In the prompt, use a fingerprint that is not enrolled. With the emulator, touch the sensor with a finger that was not registered.
  4. The callback gets onFailure(BIOMETRICS_INVALID_USER) right away, while the prompt shows "Not recognized" and stays open.
  5. Tap "Use PIN" and enter the correct PIN.
  6. The callback now also gets onSuccess, and the biometric session is valid. The next getCredentials() call returns credentials without a prompt.

This happens every time on a Pixel emulator.

Additional context

Found through react-native-auth0 5.11.0, which uses Auth0.Android 3.21.0. The app shows its locked state behind the prompt that is still open, ignores the PIN the user enters, and then unlocks without a prompt on the next attempt.

The same code is in 3.21.1, 4.1.0 and 5.0.0-beta.0.

A possible fix is to remove the resultCallback.onFailure call from onAuthenticationFailed(), or to only call super.

Auth0.Android version

3.21.0 (also present in 3.21.1, 4.1.0 and 5.0.0-beta.0)

Android version(s)

Pixel emulator. The behavior follows from how BiometricPrompt reports results, so it is not specific to one Android version.

Ngôn ngữ chính
Kotlin
Star
301
Fork
183
Merge trung bình
2 ngày 22 phút
Pull request đã merge (30 ngày)
21

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của auth0/Auth0.Android

Tất cả issue của auth0/Auth0.Android

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.