question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

auth0.webAuth.authorize sometimes does not resolve and hangs

See original GitHub issue

Describe the problem

We have a login screen that has a “Login” button on it, when you press the button it fires the following codes:

const auth0 = new Auth0({ domain, clientId });

function onPress () {
  // hangs in here forever
  const credentials = await auth0.webAuth.authorize(
    {
      scope:
        'openid profile email read:current_user offline_access',
      connection: 'Username-Password-Authentication'
    },
    {
      ephemeralSession: true
    }
  );

  // doesn't get executed
  console.log(credentials);
}

For some unknown reasons, After the user has logged in, the login page just gets stuck there but I can see “successful login” on the logs, the callee just doesn’t return to the caller, so I don’t see the console log, I also don’t see any errors or any logs at all.

It only happens on android, in ios it works fine, I’m thinking that it has something to do with the configuration rather than the code itself?

What was the expected behavior?

I expect the promise to resolve.

Reproduction

  • Step 1…
  • Step 2…

Not really sure how to replicate it, although we do have two accounts, the device originally uses account1 it has been using that for a while, then we switched to account2, that’s when this happened, I have uninstalled the app, cleared data, ./gradlew clean, etc.

Environment

  • Version of this library used: 2.7.0
  • Which framework are you using, if applicable: n/a
  • Other modules/plugins/libraries that might be involved: n/a
  • Any other relevant information you think would be useful: All given above

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aprilmintacpinedacommented, Aug 25, 2021

That doesn’t seem right, because according to the docs: https://developer.android.com/studio/build/manifest-build-variables

image

EDIT:

I think I got it, it only resolves to this when using it in the manifest itself, but since auth0 is using ${auth0Scheme} it won’t work. Unfortunately doing auth0Scheme: "${applicationId}" results to com.myappnull when I look at it in the merged manifest.

1reaction
aprilmintacpinedacommented, Feb 7, 2021

You should also check that the AndroidManifest.xml file of your android application is declaring the intent-filter with the right values (package/application id) and Auth0 domain. These need to match the URLs you allowed above in the dashboard.

Aha, that solved it, I forgot to change the android:host.

Thanks for the kind resposne 🙇🏻

Read more comments on GitHub >

github_iconTop Results From Across the Web

Auth0 hangs on auth0.webAuth.authorize()
All of a sudden today, when I call auth0.webAuth.authorize(), it hangs and does nothing. I can't find any associated error messages.
Read more >
auth0 React Native hangs on auth0.webAuth.authorize()
I use the Auth0 Universal login in my React Native app, and up until today it's worked fine. All of a sudden the...
Read more >
auth0 - Bountysource
We have a React SPA using auth0js. Sometimes, our users are unable to login. In those cases, the auth0 logs indicate successful authentication...
Read more >
Please Stop Using Local Storage - DEV Community ‍ ‍
JWTs are insecure by design: they cache authentication/authorization data, so in order to work around their speed-vs-security tradeoff you've ...
Read more >
Falcon Sandbox v8.30 © Hybrid Analysis
Spawns new processes that are not known child processes ... Opens many files with write access (often indicator for full-system infection).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found