Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

requireLocalAuthentication throws an error on Android #881

Open
6 tasks done
botre opened this issue Mar 21, 2024 · 1 comment
Open
6 tasks done

requireLocalAuthentication throws an error on Android #881

botre opened this issue Mar 21, 2024 · 1 comment
Labels
bug This points to a verified bug in the code

Comments

@botre
Copy link

botre commented Mar 21, 2024

Checklist

Description

Calling the following code will result in an error on Android, the error is thrown even when the correct passcode is entered:

  const auth0 = new Auth0({
    clientId,
    domain,
  })
  try {
    await auth0.credentialsManager.requireLocalAuthentication()
  } catch (error) {
    console.error(error)
  }

I have tested the following local authentication methods:

  • PIN
  • Fingerprint

Both result in the same error.

The error:

    "nativeStackAndroid": [
      {
        "lineNumber": 151,
        "file": "SecureCredentialsManager.kt",
        "methodName": "checkAuthenticationResult",
        "class": "com.auth0.android.authentication.storage.SecureCredentialsManager"
      },
      {
        "lineNumber": 249,
        "file": "A0Auth0Module.java",
        "methodName": "onActivityResult",
        "class": "com.auth0.react.A0Auth0Module"
      },
      {
        "lineNumber": 375,
        "file": "ReactContext.java",
        "methodName": "onActivityResult",
        "class": "com.facebook.react.bridge.ReactContext"
      },
      {
        "lineNumber": 822,
        "file": "ReactInstanceManager.java",
        "methodName": "onActivityResult",
        "class": "com.facebook.react.ReactInstanceManager"
      },
      {
        "lineNumber": 107,
        "file": "ReactDelegate.java",
        "methodName": "onActivityResult",
        "class": "com.facebook.react.ReactDelegate"
      },
      {
        "lineNumber": 136,
        "file": "ReactActivityDelegate.java",
        "methodName": "onActivityResult",
        "class": "com.facebook.react.ReactActivityDelegate"
      },
      {
        "lineNumber": 217,
        "file": "ReactActivityDelegateWrapper.kt",
        "methodName": "onActivityResult",
        "class": "expo.modules.ReactActivityDelegateWrapper"
      },
      {
        "lineNumber": 70,
        "file": "ReactActivity.java",
        "methodName": "onActivityResult",
        "class": "com.facebook.react.ReactActivity"
      },
      {
        "lineNumber": 8938,
        "file": "Activity.java",
        "methodName": "dispatchActivityResult",
        "class": "android.app.Activity"
      },
      {
        "lineNumber": 6000,
        "file": "ActivityThread.java",
        "methodName": "deliverResults",
        "class": "android.app.ActivityThread"
      },
      {
        "lineNumber": 6046,
        "file": "ActivityThread.java",
        "methodName": "handleSendResult",
        "class": "android.app.ActivityThread"
      },
      {
        "lineNumber": 67,
        "file": "ActivityResultItem.java",
        "methodName": "execute",
        "class": "android.app.servertransaction.ActivityResultItem"
      },
      {
        "lineNumber": 45,
        "file": "ActivityTransactionItem.java",
        "methodName": "execute",
        "class": "android.app.servertransaction.ActivityTransactionItem"
      },
      {
        "lineNumber": 135,
        "file": "TransactionExecutor.java",
        "methodName": "executeCallbacks",
        "class": "android.app.servertransaction.TransactionExecutor"
      },
      {
        "lineNumber": 95,
        "file": "TransactionExecutor.java",
        "methodName": "execute",
        "class": "android.app.servertransaction.TransactionExecutor"
      },
      {
        "lineNumber": 2571,
        "file": "ActivityThread.java",
        "methodName": "handleMessage",
        "class": "android.app.ActivityThread$H"
      },
      {
        "lineNumber": 106,
        "file": "Handler.java",
        "methodName": "dispatchMessage",
        "class": "android.os.Handler"
      },
      {
        "lineNumber": 226,
        "file": "Looper.java",
        "methodName": "loopOnce",
        "class": "android.os.Looper"
      },
      {
        "lineNumber": 313,
        "file": "Looper.java",
        "methodName": "loop",
        "class": "android.os.Looper"
      },
      {
        "lineNumber": 8741,
        "file": "ActivityThread.java",
        "methodName": "main",
        "class": "android.app.ActivityThread"
      },
      {
        "lineNumber": -2,
        "file": "Method.java",
        "methodName": "invoke",
        "class": "java.lang.reflect.Method"
      },
      {
        "lineNumber": 571,
        "file": "RuntimeInit.java",
        "methodName": "run",
        "class": "com.android.internal.os.RuntimeInit$MethodAndArgsCaller"
      },
      {
        "lineNumber": 1067,
        "file": "ZygoteInit.java",
        "methodName": "main",
        "class": "com.android.internal.os.ZygoteInit"
      }
    ],
    "userInfo": null,
    "message": "The user didn't pass the authentication challenge.",
    "code": "a0.invalid_state.credential_manager_exception"
  }

The error does not occur on iOS.

Reproduction

Call requireLocalAuthentication on an Android phone.
Enter the correct local authentication.
The error will be thrown.

Additional context

No response

react-native-auth0 version

3.1.0

React Native version

0.72.10

Expo version

49.0.23

Platform

Android

Platform version(s)

Android 13

@botre botre added the bug This points to a verified bug in the code label Mar 21, 2024
@brth31
Copy link

brth31 commented May 28, 2024

We are planning to address this issue along with other improvements in the next major release coming up this quarter. I'll share exact timelines by the mid of June.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This points to a verified bug in the code
Projects
None yet
Development

No branches or pull requests

2 participants