Skip to content

Custom Tabs doesn't close on redirecting back to app scheme #11

Closed
jorgenbs wants to merge 1 commit into
droibit:developfrom
jorgenbs:fix/close-on-redirect
Closed

Custom Tabs doesn't close on redirecting back to app scheme #11
jorgenbs wants to merge 1 commit into
droibit:developfrom
jorgenbs:fix/close-on-redirect

Conversation

@jorgenbs

Copy link
Copy Markdown

First off, this code is not ready as an actual fix. Its to show how I fixed my problem.
Its based off this SO post

My case:

  1. Open Custom Tabs to an Oauth sign-in flow.
  2. After sign-in, the auth-site sends a final 302 redirect to myapp://signed_in

Problem:
Custom tabs doesn't close and go back to my app, leaving the user with a blank browser screen.

By adding these flags it worked as expected.

I'm not an android or java developer, I'm not even sure what these flags mean.
But maybe extend the option-flags to include this somehow?

@droibit

droibit commented Aug 18, 2017

Copy link
Copy Markdown
Owner

@jorgenbs
I am thinking whether your PR is better solution,
and tried Pocket's OAuth using this library, Chrome closed.
Android's OAuth generally requires the following declaration in AndroidManifest.xml.
With this declaration Chrome will close.

<intent-filter>
	 <action android:name="android.intent.action.VIEW" />
	 <category android:name="android.intent.category.DEFAULT" />
	 <category android:name="android.intent.category.BROWSABLE" />
	 <data android:scheme="pocketapp1234" />
</intent-filter>

ref. https://getpocket.com/developer/docs/authentication

Have you added such a declaration to AndroidManiest.xml?

@jorgenbs

Copy link
Copy Markdown
Author

@droibit I have the exact same declarations. Maybe its the authentication server's fault.
I'll test my app towards another OAuth to see if it closes and get back to you

@droibit

droibit commented Aug 26, 2017

Copy link
Copy Markdown
Owner

@jorgenbs
Okay, I decided to add an intent flag, but I hope to add flags to options to fix edge cases.

CustomTabs.openURL(url, {
  ...
  forceCloseOnRedirection: true  // Flag names may be better.
});

Could you update like this?

@miyabi

miyabi commented Oct 3, 2017

Copy link
Copy Markdown

@jorgenbs @droibit Any updates?

@droibit

droibit commented Jul 3, 2018

Copy link
Copy Markdown
Owner

@jorgenbs @miyabi
I'm very sorry for the reply late, I merged PR (#26 ).

@jdnichollsc

jdnichollsc commented Dec 12, 2018

Copy link
Copy Markdown

Hello guys,
Can we avoid to close the browser automatically when the app go to background with this property enabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants