Skip to content

Commit 7c02136

Browse files
committed
Catch more cancel errors for Android
1 parent 482e982 commit 7c02136

File tree

7 files changed

+25
-6
lines changed

7 files changed

+25
-6
lines changed

packages/corbado_auth/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.2.1
2+
* Bump version for passkeys
3+
14
## 1.2.0
25
* Deprecate the customDomain setting (this does not have to be configured to production projects)
36
* Bump passkeys and flutter_keychain version

packages/corbado_auth/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: corbado_auth
22
description: Flutter package for Corbado Auth. Enables authentication on Android and iOS using passkeys.
33
homepage: https://docs.corbado.com/overview/welcome
44
repository: https://github.com/corbado/flutter-passkeys/tree/main/packages/corbado_auth
5-
version: 1.2.0
5+
version: 1.2.1
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"

packages/passkeys/passkeys/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 1.3.2
2+
* Bump version for passkeys_android
3+
14
## 1.3.1
25
* Bump versions for passkeys_ios, passkeys_android and passkeys_platform_interface
36

packages/passkeys/passkeys/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: passkeys
22
description: Flutter plugin enabling simple passkey authentication. Can be either used with a ready-to-use relying party server (Corbado) or with your custom relying party.
33
homepage: https://docs.corbado.com/overview/welcome
44
repository: https://github.com/corbado/flutter-passkeys/tree/main/packages/passkeys/passkeys
5-
version: 1.3.1
5+
version: 1.3.2
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"
@@ -24,7 +24,7 @@ dependencies:
2424
http: ^1.1.0
2525
json_annotation: ^4.8.1
2626
openapi_generator_annotations: ^4.10.0
27-
passkeys_android: ^1.2.0
27+
passkeys_android: ^1.2.1
2828
passkeys_ios: ^1.2.0
2929
passkeys_platform_interface: ^1.2.0
3030
ua_client_hints: ^1.1.3

packages/passkeys/passkeys_android/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.2.1
2+
3+
* Catch more situations when a user interrupts biometrics ceremony (e.g. providing his fingerprint).
4+
15
## 1.2.0
26

37
* Bump passkeys_platform_interface version.

packages/passkeys/passkeys_android/android/src/main/java/com/corbado/passkeys_android/MessageHandler.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import androidx.credentials.exceptions.GetCredentialException;
2424
import androidx.credentials.exceptions.NoCredentialException;
2525
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialDomException;
26+
import androidx.credentials.exceptions.publickeycredential.CreatePublicKeyCredentialException;
2627
import androidx.credentials.exceptions.publickeycredential.GetPublicKeyCredentialDomException;
2728

2829
import com.corbado.passkeys_android.models.login.AllowCredentialType;
@@ -105,7 +106,10 @@ public void onResult(CreateCredentialResponse res) {
105106
@Override
106107
public void onError(CreateCredentialException e) {
107108
Exception platformException = e;
108-
if (e instanceof CreateCredentialCancellationException) {
109+
if (Objects.equals(e.getMessage(), "Unable to create key during registration")) {
110+
// currently, Android throws this error when users skip the fingerPrint animation => we interpret this as a cancellation for now
111+
platformException = new Messages.FlutterError("cancelled", e.getMessage(), "");
112+
} else if (e instanceof CreateCredentialCancellationException) {
109113
platformException = new Messages.FlutterError("cancelled", e.getMessage(), "");
110114
} else if (e instanceof CreatePublicKeyCredentialDomException) {
111115
if (Objects.equals(e.getMessage(), "User is unable to create passkeys.")) {
@@ -179,7 +183,12 @@ public void onResult(GetCredentialResponse res) {
179183
@Override
180184
public void onError(GetCredentialException e) {
181185
Exception platformException = e;
182-
if (e instanceof GetCredentialCancellationException) {
186+
Log.e(TAG, "onError called", e);
187+
188+
// currently, Android throws this error when users skip the fingerPrint animation => we interpret this as a cancellation for now
189+
if (Objects.equals(e.getMessage(), "None of the allowed credentials can be authenticated")) {
190+
platformException = new Messages.FlutterError("cancelled", e.getMessage(), "");
191+
} else if (e instanceof GetCredentialCancellationException) {
183192
platformException = new Messages.FlutterError("cancelled", e.getMessage(), "");
184193
} else if (e instanceof NoCredentialException) {
185194
platformException = new Messages.FlutterError("android-no-credential", e.getMessage(), "");

packages/passkeys/passkeys_android/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: passkeys_android
22
description: Android implementation of the Corbado passkeys plugin. Manages the creation of passkeys on Android devices.
33
homepage: https://docs.corbado.com/overview/welcome
44
repository: https://github.com/corbado/flutter-passkeys/tree/main/packages/passkeys/passkeys_android
5-
version: 1.2.0
5+
version: 1.2.1
66

77
environment:
88
sdk: ">=3.0.0 <4.0.0"

0 commit comments

Comments
 (0)