react-native-auth0: Stuck at log in after entering credentials on Android, doesn't redirect back or log me in

Describe the problem

Issues with loggin in with an android device / simulator. After entering the credentials in the browser that appears, I press “Continue” and I see in the top of my browser that it tries to load the request but stops loading after about one second and then nothing happens. Nothing happens if I press the “Continue”-button either.

But this only happens when I enter the correct credentials. If I enter the wrong ones on purpose, it will give me an error that its wrong.

And when I press back/exit the browser to return to the app to try again, the browser just stays blank. Nothing happens and I can’t trigger anything.

This ONLY happens on android, iOS works just fine.

What was the expected behavior?

Be able to log in without issue on android. After I’ve put in credentials and pressed “Continue”, it should redirect me back to app and I should be logged in.

Reproduction

Set up a new expo project with Typescript and the latest SDK. Add react-native-auth0 & @types/react-native-auth0.

Copy the example code detailed here for example https://github.com/auth0-samples/auth0-react-native-sample/tree/master/00-Login-Expo

Environment

react-native-auth0@2.17.1 @types/react-native-auth0@2.14.1 react-native@0.71.4 expo@48.0.9

react-native info:

System:
    OS: macOS 13.2.1
    CPU: (8) arm64 Apple M1
    Memory: 129.78 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.14.2 - ~/.nvm/versions/node/v16.14.2/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm
    Watchman: 2022.08.22.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 23, 26, 28, 29, 30, 31, 33
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 33.0.0
      System Images: android-31 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.1 AI-221.6008.13.2211.9619390
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.13 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0
    react-native: 0.71.4 => 0.71.4
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Please let me know if there’s any other information I can provide.

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

I understand that application ID cannot be changed. That is the reason we provide customScheme. Can you swap the customScheme to “auth0” and test it just to ensure we are getting things right.

The callback URL should be

auth0://auth.staylive.io/ios/se.staylive.App/callback, 
auth0://auth.staylive.io/android/se.staylive.App/callback, 

The code should be

 data = await auth0.webAuth.authorize(
        {
          scope: 'openid profile email offline_access',
          organization: organizationId,
          audience: Constants.AUTH0_AUDIENCE,
        },
        { ephemeralSession: true, customScheme: 'auth0' },
      );

The app.config.json should be

plugins: [
 .....
    [
      'react-native-auth0',
      {
        domain: 'staylive.eu.auth0.com',
        customScheme: 'auth0',
      },
    ],
    ]

Hi @poovamraj and thanks again.

Sorry to say that this didn’t change anything, the same issue still persists. I believe that @KMathisGit posted some interesting thoughts in the link above which might be worth looking into