expo: [expo-auth-session] Popup doesn't close after redirect using React Hooks
🐛 Bug Report
Environment
Expo Client and Web
Steps to Reproduce
- Use expo-auth-session Hooks as shown in the guides at this page: https://docs.expo.io/versions/latest/sdk/auth-session
- Invoke the
promptAsyncfunction returned byuseAuthRequest - A popup browser window opens which allows to authenticate to the external provider
- In Web: the application is reloaded inside the popup rather than closing the popup. Authentication information is provided to the app as querystring parameters to the
redirectUrl, yet the app doesn’t seem to be picking them up - In Client: an error appears which says:
Something went wrong trying to finish signing in. Please close this screen to go back to the app
Expected Behavior
The popup closes automatically and the user is authenticated
Actual Behavior
In both Web and Client, closing the popup/screen will cause the auth result to be “dismissed”
Reproducible Demo
I don’t have one available but I can create one if useful. I’d like to understand if there’s anything I’m doing clearly wrong and this is supposed to work first. None of the examples in the examples repository show Hooks being used.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 1
- Comments: 16 (1 by maintainers)
Found the solution, which is documented only in the Identity 4 section of the docs, which is basically adding this code:
Hey @sbrighiu, I am having the same problem you were. With the global callback change, I was able to get the popup window to close. But in the old window, the user is not logged in. How were you able to pass the auth payload to that window?
This is all for Desktop Web browser. I have mobile working fine
Hi @simoneb! It would definitely be helpful to add a small repro, e.g. in snack. 😄 I’m not sure what’s going on, but maybe you can check out some of the vendor-specific examples. It should include an example with the hooks you mentioned, e.g. GitHub or Google.