Skip to content

Conversation

@jorgenbs
Copy link

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
Copy link
Owner

droibit commented Aug 18, 2017

@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
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
Copy link
Owner

droibit commented Aug 26, 2017

@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
Copy link

miyabi commented Oct 3, 2017

@jorgenbs @droibit Any updates?

@droibit
Copy link
Owner

droibit commented Jul 3, 2018

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

@jdnichollsc
Copy link

jdnichollsc commented Dec 12, 2018

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