react-native-auth0 icon indicating copy to clipboard operation
react-native-auth0 copied to clipboard

requireLocalAuthentication throws an error on Android

Open botre opened this issue 1 year ago • 2 comments

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 avatar Mar 21 '24 12:03 botre

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.

brth31 avatar May 28 '24 10:05 brth31

Curious if y'all are going to be sharing timelines about this 👀

mikehuebner avatar Jul 17 '24 22:07 mikehuebner

@mikehuebner Apologies for not communicating timelines earlier. v4 beta is already out and it should address this issue. Could you confirm if this is resolved?

brth31 avatar Nov 15 '24 05:11 brth31

@mikehuebner Hope this issue was solved in the latest version of our SDKs. We will close this issue for now. Feel free to comment here to reopen this if required.

poovamraj avatar Jan 30 '25 11:01 poovamraj