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

WebAuth never opens safari on iOS #84

Closed
sebirdman opened this issue Aug 25, 2017 · 5 comments
Closed

WebAuth never opens safari on iOS #84

sebirdman opened this issue Aug 25, 2017 · 5 comments
Labels
bug This points to a verified bug in the code
Milestone

Comments

@sebirdman
Copy link

During testing I saw this issue on debug builds and thought nothing of it (worked in release, so all seems good right?) However, I now have one of my testers reporting the same issue on a release build:

Here is the warning i see in xcode:

Warning: Attempt to present <SFSafariViewController: 0x102363bc0> on <UIViewController: 0x10241ea00> which is already presenting <RCTModalHostViewController: 0x102337990>

Interestingly, if I avoid using SFSafariViewControler and instead do:

sebirdman@b439e1f

then the page opens and login works as expected.

I'm very new to iOS development, maybe there's an easier fix for the above warning or a particular reason SFSafariViewController was chosen over just openURL?

@sebirdman
Copy link
Author

sebirdman commented Aug 25, 2017

Ah, i've found another bit.

During login, we display a Modal that shows "logging in" if i disable that modal (which i supect is using RCTModalHostViewController) then the page opens as expected every time without any code changes.

very strange.

@cocojoe
Copy link
Member

cocojoe commented Sep 7, 2017

Sounds like you already have the solution, dismiss your modal before calling WebAuth.

@cocojoe cocojoe closed this as completed Sep 7, 2017
@stefanedberg
Copy link

I'm having a similar issue. In my use case I have a tabbed application (with react-native-navigation) and when the user isn't authenticated (the first time they launch the app or when the JWT is not valid anymore) I'd like to show the login in a modal. We have a multi-tenant solution that requires them to first enter their account name and then logging in with Auth0. When I try to authenticate with Auth0 the webauth doesn't open and I get this Warning: Attempt to present SFSafariViewController on RCCTabBarController whose view is not in the window hierarchy @cocojoe

@cocojoe cocojoe reopened this Sep 7, 2017
@cocojoe cocojoe added the bug This points to a verified bug in the code label Sep 7, 2017
@cocojoe
Copy link
Member

cocojoe commented Sep 7, 2017

OK have made PR to ensure the SFSafariViewController is presented from the topmost view controller. @stefanedberg @sebirdman please can you try #89 and report back. Thanks

@stefanedberg
Copy link

Solved my use case. Works as expected, thanks @cocojoe.

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

No branches or pull requests

4 participants