-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[expo-web-browser] Browser closes when switching to a different app temporarily (Android) #8072
Comments
Hi @Rohansi, thanks for your report and example! Unfortunately, this is the expected behavior from the new chrome custom tabs. But there is a way to prevent closing the chrome tab, you can use
Hope it helps! |
Thank you @byCedric, but how do I set that from |
I'm so sorry! I thought I copied the snipper for auth-sesison, here it is:
|
Closing since this is expected behavior |
@cruzach I don't really buy that there is no way around this. Chrome Custom Tabs are pretty much the standard and recommended way of authenticating with other services. Two factor authentication is also strongly recommended. I haven't seen an app which leaves login pages in the app switcher, and I haven't seen any break when switching to get your two factor code, so what are they doing differently? Both of these options are bad UX - even if one of them is much better than the other. |
@Rohansi I'm a little confused- after adding |
@cruzach It works fine but the login page sticks around in the app switcher. This will be confusing for users because there is no indication that it's for my app or that they are meant to just close it. Additionally, if you press the back button after logging in you will return to the custom tab! I googled this problem and found that there does seem to be a solution to it but it looks quite convoluted. Android things, I guess. Quite detailed documentation on the solution here: https://github.com/openid/AppAuth-Android/blob/f1dbeb51f4d905523d804d70363abdb00728d99c/library/java/net/openid/appauth/AuthorizationManagementActivity.java Article I found explaining that it's a pain point for everyone: https://medium.com/@vardaansh1/use-chrome-custom-tabs-they-said-it-will-be-fun-they-said-b5fabe5daea3 It would be great if you could get this behavior working in Expo! I'm also stuck with OpenID 2.0 (the old one! - not OAuth or OpenID Connect) so I wouldn't benefit from the newer |
It's been a while since we've had any activity on this issue, and seeing as it needs more info before we can properly address it, we will be closing it in one month. If you've found a fix, please share it! Otherwise, please provide the info we asked for, especially a reproducible example. Thanks! |
It's been a while since we've had any activity on this issue, and seeing as it needs more info before we can properly address it, we will be closing it in one month. If you've found a fix, please share it! Otherwise, please provide the info we asked for, especially a reproducible example. Thanks! |
Hello, we have exactly the same issue here. The showInRecent fixes it but the form continues to be accessible by the user and the user can redo the operation again and again. This is not acceptable for our payment solution. |
@robinbiondi - @byCedric was saying this is expected behavior from the chrome custom tabs api, not that it is something that users would necessarily expect. sadly not every abstraction can work identically across platforms due to quirks in how they are implemented in different operating systems. if you think we are missing some aspect of the chrome custom tabs api that would make this possible without adding the |
@Rohansi - open a pull request. if we're able to review and merge it by the end of next week we can possibly land it in sdk 41 |
Hey, any update regarding the resolution within expo managed flow? Or possible alternatives? Thank you. Here is an OAuth PR that may help - openid/AppAuth-Android#109 |
It's been a while since we've had any activity on this issue, and seeing as it needs more info before we can properly address it, we will be closing it in one month. If you've found a fix, please share it! Otherwise, please provide the info we asked for, especially a reproducible example. Thanks! |
This issue has been automatically closed since there has not been any recent activity after it was marked as stale. Please open a new issue for any related bugs. |
Boop again, not stale |
is there a good solutions now? |
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
@forki Not that I know of within Expo |
I was facing the same problem, authentication did not work at all when using password manager (after switching back from the password manager, the authentication window was lost). For me, the solution was to change this in my code: const [request, response, prompt] = useAuthRequest( /* ... */ );
// ...
-prompt();
+prompt({ createTask: false }); |
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
This is still an issue - not stale |
Indeed using |
This issue is stale because it has been open for 60 days with no activity. If there is no activity in the next 7 days, the issue will be closed. |
Not stale |
We are also facing this issue especially when you have OAuth2.0 with Azure AD and you have MFA enabled. I tried with createTask: false and it helps as well but, if you don't use your authenticator within 10 seconds the browser popup is stuck and it doesn't redirect back so the user is stuck at the login screen. I would really appreciate it if anyone has any further solution for it. |
Hi everyone, We have been using the One of the proposed solutions that we've found here: https://stackoverflow.com/questions/66080607/expo-authsession-returns-dismiss-on-android-device is setting up I have tried using the dismiss method imported from the |
When using {showInRecents: true} Chrome custom tabs, the window is not closed on redirection. If you use { createTask: false }, the same thing happens and the chrome window overlaps the APP, having to click on the X in the window to close it. something that is not expected, but automatic closing. |
We have a similar issue on Android:
Has anyone else experienced this? This might be caused by how we open our app (see the Android app lifecycle for more info), or this might be caused by expo auth session. We're currently using Expo |
Hi @JPStrydom, we are facing the same issue right now, did you figure out how to keep the auth session active when the user opens the app via the app icon? |
Hi @JPStrydom, I think I have found a piece of code that is causing the issue that we are facing. It's in the When the user returns to the app using the app icon, the listener is triggered with the state "active" which triggers the browser to close. Does anyone have a solution for it? We would like to keep the user auth session until it's closed manually. |
We have the same issue using WebauthN create function on some smartphones that open a new activity for fingerprint input. |
this worked for us on Android
"expo": "50.0.8" |
It only works on Android, on IOS it doesn't work at all! |
🐛 Bug Report
Environment
Targeting Android and iOS using the managed workflow. Experiencing this problem on Android in both the client and standalone.
Steps to Reproduce
Start your login flow using
AuthSession.startAsync
and then continue it when it resolves successfully. If it's not successful then give the user an option to retry.After starting the login flow the browser should open. Switch to another app and then switch back to the login screen.
Expected Behavior
The browser should stay open when returning to the app.
Actual Behavior
The browser closes and the user must restart their login process. This is a major issue for anything using two factor authentication because they will need to switch apps after entering their email and password, copy a code, and then paste it on the login page to continue.
Reproducible Demo
https://snack.expo.io/7wvmAi3cf
The text was updated successfully, but these errors were encountered: