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

Redirect while app in background with Chrome custom tabs #135

Open
dhei opened this issue Jan 4, 2017 · 10 comments
Open

Redirect while app in background with Chrome custom tabs #135

dhei opened this issue Jan 4, 2017 · 10 comments
Labels

Comments

@dhei
Copy link

dhei commented Jan 4, 2017

I am playing with the demo app using Chrome custom tabs (Chrome 55) vs. different browsers on an Android 6.0.1 device. I have configure the demo app to make it work properly. I also want to understand the common failures during user login using Chrome custom tabs compared to other browsers.

So I try to put the app into background after entering username & password but before redirect to custom scheme, to see if redirecting still works (RedirectUriReceiverActivity gets called). What I found it’s quite confusing - after Chrome custom tabs sent to the background, redirect never happen. Same behavior for a Chrome browser. Looks like this is not a Chrome custom tabs specific behavior, but to Chrome itself. I tried this scenario on Firefox browser (latest version) and Opera browser (latest version), redirect works fine even app in the background and RedirectUriReceiverActivity get called.

My question is why redirect not working when app in the background for Chrome custom tabs? Is this by design? If it is by design, are there any workarounds?

Thanks

@iainmcgin
Copy link
Member

This sounds like it may be a Chrome bug, but I'd like to clarify the steps you are taking so I can report it. It sounds like the steps are you are taking are:

  1. Start the authorization flow from the demo app, which opens a Chrome Custom Tab / Chrome browser.
  2. Enter the authentication details into the tab, but do not submit them.
  3. Switch to another app / the device home screen.
  4. Switch back to the custom tab / browser, and submit the authentication details.
  5. At this point, you expect that the redirect should be captured and processed by the app, but this does not happen.

Is this accurate? If so, what does happen at step 5 - does the browser / tab navigate directly to some other page, show an error, or appear to do nothing?

Could you provide the exact version of Chrome (e.g. 55.0.2883.95) and the Android OS version (e.g. 7.1) on the device you are testing with?

@dhei
Copy link
Author

dhei commented Jan 4, 2017

@iainmcgin, thanks for your response.

Here are the steps to repro with Chrome 55.0.2883.91 on Android 6.0.1:

  1. Start the authorization flow from the demo app, which opens a Chrome Custom Tab.
  2. Enter username and password into the tab and click ‘Sign in’
  3. In the ‘AppAuth Demo would like to’ permission page, click ‘Allow’
  4. Immediately switch the app to the background before redirect kicks in. Wait a few seconds. I expect redirect should happen at this point and switch me from background to the app. But nothing happens.
  5. Switch back to the app, I see the original start page of the demo app, my auth flow is lost.

Note: Step 5 using Firefox/Opera does give me the expected behavior - redirect to the app when the app is in the background.

Thanks.

@dhei
Copy link
Author

dhei commented Jan 6, 2017

@iainmcgin, I was wondering if you have a chance to repro this issue? Thanks.

@iainmcgin
Copy link
Member

Sorry, I've been out for a few weeks as I recently got married. I'm back now, and I'll try and repro this week.

@cjolif
Copy link

cjolif commented Jan 26, 2017

@iainmcgin congratulations :) Any news? (we do have the same issue as @dhei)

@iainmcgin
Copy link
Member

I suspect it might be a Chrome issue - I wouldn't expect the redirect to happen in the background as the browser tab should be "frozen" when not visible. However, it should pick up from where it left off when you switch back, so some state must be being lost when switching out and back in.

Is this occurring in a common scenario, or are you just testing for robustness? I'll flag this to the Chrome Custom Tab engineers to see if they have an explanation.

@cjolif
Copy link

cjolif commented Jan 27, 2017

Nothing special, we just get that without doing anything special.

@SanjeevKumarPandey
Copy link

Is it too late to ask here? Wondering what exactly it means - '..browser tab should be "frozen" when not visible'? Is this a Custom Tabs behavior i.e. the redirect wouldn't happen if its in the background OR more in other sense 'user will always see the redirect happening, it can't be hidden'?

@contextsw
Copy link

contextsw commented Oct 9, 2020

@iainmcgin
We are almost 4 years into this issue has there been a resolution as it is becoming a blocker. The AWS Cognito has been resolved can't we borrow their solution?

@verejoel
Copy link

Are there any updates on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants