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

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:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:30 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
MrPumpkingcommented, Jan 18, 2021

I’ve been struggling with this too. From what I’ve found, the redirectUri scheme has to match your Android package (ex. for package name com.example the redirectUri would be com.example:/oauthredirect). After making my scheme key 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 to expo-google-app-auth for the time being.

2reactions
jfbncommented, Oct 28, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expo AuthSession immediately resolves as "dismiss"ed
In a dev environment I never have an issue, but in a published app the promise often resolves immediately with { type: dismiss...
Read more >
AuthSession - Expo Documentation
AuthSession is the easiest way to add web browser based authentication (for example, browser-based OAuth flows) to your app, built on top of...
Read more >
Google Sign In - response type dismiss : r/reactnative - Reddit
The dismiss should popup when the user closes the auth browser and goes back to the app, shouldn't it be giving a success...
Read more >
How Do I Logout Automatically When Using Form ...
The issue is that after login when i close browser and re run application again it shows logout instead of login however if...
Read more >
Authentication State Persistence | Firebase - Google
For a web application, the default behavior is to persist a user's session even after the user closes the browser. This is convenient...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found