Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changes/fix-ios-biometry-fallback-auth.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"biometric": patch:bug
"biometric-js": patch:bug
---

Fix biometric plugin ignoring fallback logic when biometry status is unavailable or not enrolled on iOS.
11 changes: 6 additions & 5 deletions plugins/biometric/ios/Sources/BiometricPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,23 +98,24 @@ 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 ?? ""
)
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,
Expand Down
Loading