auth0 / react-native-auth0

React Native toolkit for Auth0 API
https://auth0.com
MIT License
480 stars 206 forks source link

User cancelled the Auth on callback #504

Closed mweel1 closed 1 year ago

mweel1 commented 2 years ago

On the call back of my android react native app I get the following error:

{"error": "a0.session.user_cancelled", "error_description": "User cancelled the Auth"}

I've tried all the suggestions in the issue tracker with no success. Any thoughts on how to debug this?

dutradotdev commented 2 years ago

same error on android, iOS works well.

poovamraj commented 2 years ago

@mweel1 @dutradotdev, can you provide the steps to reproduce this issue? This error is thrown only when the user explicitly cancels the login flow

mweel1 commented 2 years ago

Here is the link coming back from Auth0

Its obvious the user is not canceling the auth process as this is the link calling back

io.xxxxxxxx.enforcement://xxxxxxx.us.auth0.com/android/ioxxxxxx.enforcement/callback?code=IYdtOeydL8OQ-HmTDvMMJNn1d4SzglYb0g4Ko_tcKWXnm&state=M5KeYkSX0L_XZJB1aCO8sYyyPcQBP-vsG2HPfo6N_Hg

LOG {"error": "a0.session.user_cancelled", "error_description": "User cancelled the Auth"}

poovamraj commented 2 years ago

Hi @mweel1 I agree, but we would need more information to reproduce this issue.

Information on these questions will greatly help us find and fix this issue.

dutradotdev commented 2 years ago

hey @mweel1

I followed this diff https://github.com/auth0-samples/auth0-react-native-sample/commit/69f79c83ceed40f44b239bbd16e79ecaa70ef70a and now it is working on Android!

mweel1 commented 2 years ago

Is this happening only in specific devices/OS versions?

No, it happens on both IOS & Android

Are there any particular case in which it is not working?

There is really only one use case, login and it doesn't work.

Does the MergedManifest have RedirectActivity with the proper intent filter applied?

Where would lI find this?

Can you see the error thrown when using Chrome Debugger when the redirection is failing?

When I console log the error from the try/catch on authorize its:

{"error": "a0.session.user_cancelled", "error_description": "User cancelled the Auth"}

poovamraj commented 2 years ago

It is interesting that it is not working in both iOS and Android. It would be better if you can share a sample app in which this issue can be reproduced for us to debug this further.

poovamraj commented 1 year ago

Hello @mweel1 and @dutradotdev, I tried to reproduce this issue for quite sometime with no result. We will close this issue for now but please feel free to reopen if you can provide us with more details

davecoffin commented 1 year ago

@mweel1 Did you resolve this? I'm having the same issue. @dutradotdev I have followed this diff as well https://github.com/auth0-samples/auth0-react-native-sample/commit/69f79c83ceed40f44b239bbd16e79ecaa70ef70a

poovamraj commented 1 year ago

@davecoffin

We would love to help you with this issue just that we don't have much to go ahead with.

delaneybrian commented 1 year ago

I've been experiencing a similar issue where I get the error:

{"error": "a0.session.user_cancelled", "error_description": "User cancelled the Auth"}

I'm using:

"react-native": "0.70.5", "react-native-auth0": "^2.17.1"

Experiencing it on android (have not tried iOS) using expo dev-client.

I'm not a professional or a full time react native developer so just following on with some details of experiencing the same issue.

If I have time to reproduce in the sample app I will try.

LucasSolares commented 1 year ago

Hi, I'm facing this issue in a react-native-cli app, also using react native navigation, but I have to implement this bad fix, to make it work.

useEffect(() => {
    (async () => {
      if (error && (error as any).error === 'a0.session.user_cancelled') {
        await authorize();
      }
    })();
  }, [error, authorize]);

It seems that this is only happening the first time I tried to sign in and also is happening in both emulator & physical devices.

florianrusso commented 1 year ago

I'm facing a similar issue on my android app, I can not reproduce in the 00-Login-Hooks sample app. I have a similar code in my app compare to the sample app, which leads me to suppose something interfere with the auth-0 package

gbower30 commented 11 months ago

I'm also encountering the same issue with Android, but for some reason it's worse when using the development tenant where it requires three attempts before finally signing in as opposed to 2 with the production tenant.

localyte-nelson commented 10 months ago

also seeing this issue with v2.17.1