From 82830dea46937cf11bc50d77300d25c3e71af753 Mon Sep 17 00:00:00 2001 From: pjf-dev <28768673+pjf-dev@users.noreply.github.com> Date: Mon, 14 Apr 2025 17:21:18 -0400 Subject: [PATCH 1/3] Fix early biometric status check not accounting for allowDeviceCredential fallback logic --- plugins/biometric/ios/Sources/BiometricPlugin.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/plugins/biometric/ios/Sources/BiometricPlugin.swift b/plugins/biometric/ios/Sources/BiometricPlugin.swift index 3c9a192a81..c295904aa4 100644 --- a/plugins/biometric/ios/Sources/BiometricPlugin.swift +++ b/plugins/biometric/ios/Sources/BiometricPlugin.swift @@ -98,7 +98,12 @@ class BiometricPlugin: Plugin { } @objc func authenticate(_ invoke: Invoke) throws { - guard self.status.available else { + let args = try invoke.parseArgs(AuthOptions.self) + + let allowDeviceCredential = args.allowDeviceCredential ?? false + + guard self.status.available || allowDeviceCredential else { + // Biometry unavailable, fallback disabled invoke.reject( self.status.errorReason ?? "", code: self.status.errorCode ?? "" @@ -106,15 +111,11 @@ class BiometricPlugin: Plugin { return } - let args = try invoke.parseArgs(AuthOptions.self) - let context = LAContext() context.localizedFallbackTitle = args.fallbackTitle context.localizedCancelTitle = args.cancelTitle context.touchIDAuthenticationAllowableReuseDuration = 0 - let allowDeviceCredential = args.allowDeviceCredential ?? false - // force system default fallback title if an empty string is provided (the OS hides the fallback button in this case) if allowDeviceCredential, let fallbackTitle = context.localizedFallbackTitle, From 3f74de8966825149159a2e2b895fd05f80a57fc6 Mon Sep 17 00:00:00 2001 From: pjf-dev <28768673+pjf-dev@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:14:08 -0400 Subject: [PATCH 2/3] Add change file --- .changes/fix-ios-biometry-fallback-auth.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changes/fix-ios-biometry-fallback-auth.md diff --git a/.changes/fix-ios-biometry-fallback-auth.md b/.changes/fix-ios-biometry-fallback-auth.md new file mode 100644 index 0000000000..50e3852346 --- /dev/null +++ b/.changes/fix-ios-biometry-fallback-auth.md @@ -0,0 +1,6 @@ +--- +"biometric": patch:bug +"biometric-js": patch:bug +--- + +Fix biometric plugin not prompting for fallback credentials when biometry status is unavailable or not enrolled on iOS. From b615f479b5143893c0111fe82734f551c5dc31fc Mon Sep 17 00:00:00 2001 From: pjf-dev <28768673+pjf-dev@users.noreply.github.com> Date: Mon, 14 Apr 2025 19:45:05 -0400 Subject: [PATCH 3/3] Rephrase change to better describe issue --- .changes/fix-ios-biometry-fallback-auth.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changes/fix-ios-biometry-fallback-auth.md b/.changes/fix-ios-biometry-fallback-auth.md index 50e3852346..c01159f0e6 100644 --- a/.changes/fix-ios-biometry-fallback-auth.md +++ b/.changes/fix-ios-biometry-fallback-auth.md @@ -3,4 +3,4 @@ "biometric-js": patch:bug --- -Fix biometric plugin not prompting for fallback credentials when biometry status is unavailable or not enrolled on iOS. +Fix biometric plugin ignoring fallback logic when biometry status is unavailable or not enrolled on iOS.