Auth session returns dismiss before browser closes
See original GitHub issue🐛 Bug Report
Summary of Issue
When using “useAuthRequest()”, the response is of type: “dismiss” even before the browser window closes when the flow is completed. This only happens with standalone build for android, both expo environment and iOS works perfectly. I have tried all fixes in the related issue #6679, and we would like to not use proxy, so startAsync() wont work.
Environment - output of expo diagnostics & the platform(s) you’re targeting
- Only on android in standalone release mode
- Both in simulator, on device and trough play store internal testing
Expo CLI 3.23.3 environment info: System: OS: Windows 10 10.0.18362 Binaries: Node: 12.18.0 - C:\Program Files\nodejs\node.EXE npm: 6.14.7 - C:\Program Files\nodejs\npm.CMD npmPackages: expo: ~38.0.8 => 38.0.9 react: ~16.11.0 => 16.11.0 react-dom: ~16.11.0 => 16.11.0 react-native: https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz => 0.62.2 react-native-web: ~0.11.7 => 0.11.7
Reproducible Demo
Link to code that reproduces the issue: https://snack.expo.io/@simenbakken/auth-session-bug
Steps to Reproduce
- Create a new managed project
- Implement auth session from tutorial for Azure: https://docs.expo.io/guides/authentication/#azure
Expected Behavior vs Actual Behavior
Expected: Browser opens on login button press and user enters credentials. When login flow is completed, the browser closes, and the text field is updated with response from Azure.
Actual: Browser opens on login button press and user enters credential. When login flow is completed, the browser closes, and the text field is always {“type”:“dismiss”} even if login is successful (only and android as discussed above, iOS and expo dev works as expected). It seams like dismissed is returned even before browser is opened, as sometimes if i create an Alert.alert() after await promptAsync(), i can catch a glimt of the alert as the browser opens.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:30 (8 by maintainers)
Top Related StackOverflow Question
I’ve been struggling with this too. From what I’ve found, the
redirectUrischeme has to match your Android package (ex. for package namecom.examplethe redirectUri would becom.example:/oauthredirect). After making myschemekey match the Android package, I was able to sign in successfully, but there was another problem. After successful login I was prompted to select the app with which I’d like to continue with, and there were 2 options available - both being my app, with the difference being that only one works. Not sure how to get around this one, so I guess I’ll be switching toexpo-google-app-authfor the time being.I too am experiencing this issue. I don’t have uppercase letters in the redirect uri, and I don’t have 3 slashes in a row.
It works on iOS but on Android it doesn’t work in emulator or in production.
EDIT: Like @rikkitissier above, I am using WebBrowser.openAuthSessionAsync without useAuthRequest.