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

On iOS the promise returned by webauth.authorize can sometimes never complete. #460

Closed
marcelmeulemans opened this issue Feb 24, 2022 · 4 comments · Fixed by #464
Closed
Labels
bug This points to a verified bug in the code

Comments

@marcelmeulemans
Copy link

Describe the problem

The promise returned by webAuth.authorize() will consistently not complete when called immediately again after pressing cancel on the iOS permission popup (i.e. "App" want to use...). The issue is related to this if statement:

https://github.com/auth0/react-native-auth0/blob/master/src/webauth/agent.js#L44

In reproduction situation both redirectURL and closeOnLoad are both falsy and the urlHandler will never be called so the promise being returned never completes.

What was the expected behavior?

The promise should always resolve or reject.

Reproduction

I can across this behaviour by automatically calling authorize again when the authorize promise rejects. Something like:

try {
  await webAuth.authorize();
} catch (_) {
  setTimeout(() => webAuth.authorize(), 0);
}
  1. Call webAuth.authorize()
  2. Press cancel when iOS ask permission for "App" Wants to use "auth0.com" to sign in.
  3. Immediately call webAuth.authorize() again.

The returned promise from step 3 will never complete. When the timeout is increased to 1000 the problem does not manifest.

I can probably provide a reproduction scenario via the sample app if the above does not highlight the problem clearly enough.

Environment

  • Version of this library used:
    2.13.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:
    ephemeralSession is false
@Widcket Widcket added the needs investigation An issue that has more questions to answer or otherwise needs work to fully understand the issue label Mar 12, 2022
@Widcket
Copy link
Contributor

Widcket commented Mar 12, 2022

Hi @marcelmeulemans, thanks for raising this.
I'm a bit busy ATM, but I'll try to take a look at this next week.

@Widcket Widcket added bug This points to a verified bug in the code and removed needs investigation An issue that has more questions to answer or otherwise needs work to fully understand the issue labels Mar 18, 2022
@marcelmeulemans
Copy link
Author

Thanks @Widcket!

@sophie-li
Copy link

Thanks so much! Do we have an ETA for when will this be released? 😄

@Widcket
Copy link
Contributor

Widcket commented Apr 1, 2022

@sophie-li it's out now: https://github.com/auth0/react-native-auth0/releases/tag/v2.13.1

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

Successfully merging a pull request may close this issue.

3 participants