-
Notifications
You must be signed in to change notification settings - Fork 209
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
Handle incomplete promise in web authentication #798
Conversation
Hi @poovamraj, it seems this PR forces a cancellation of the promise when the auth window is closed prematurely. Whilst this is valid for unknown events which cause the auth window to be closed, I would argue that stopping the auth window from being closed when the app is backgrounded and relaunched via the app icon or a deep link is also required (you mentioned on #785 this should be possible). The reasoning is it's completely normal for a user to background the app during an auth flow to open their email or sms app if there is an auth0 action that requires email verification or 2FA enrolment as part of the login flow For example, if email verification is required on registration, if the user does the verification on the same device and then relaunches the app via the app icon, this would result in a broken registration process where the auth window disappears and the app is in an a signed out state. And it would not be evident to users that their account has actually been created already and they need to do a Sign In and not another Register. I know this to be the case as this is what happens in the v2 version of the package as it does something similar with the In our current implementation using the v2 version of the package, we ended up fixing the broken registration flow with a complicated solution looking for the Can I also suggest that we use a different code to |
@rick-lannan-upgrowth I understand this and that is the intention of the SDK as well. But there is a limitation in react-native where it forces to create a new task from the root when the app is opened as you can see here. This means no matter what we do in our SDK a new task will be created from the root because of how React Native is configured. You can override this behaviour by setting the
All this basically does is removes the About the error message, I agree that this can be a more unique error message. We will update it from our end 👍 |
Changes
We have a issue in our RNA where the promise for web authentication remains incomplete if the user moves out of the app in between the login.
This is happening because React Native opens the root instance of a task because it uses launch mode as singleTask which usually doesn't happen in Android apps.
To fix this we handle the
onNewIntent
and reject the promise that the user has cancelled the authentication.References
#785
Testing
The changes have been tested manually