Home » Android » android – CustomTabs shows ERR_UNKNOWN_URL_SCHEME after 302 Redirect

android – CustomTabs shows ERR_UNKNOWN_URL_SCHEME after 302 Redirect

Posted by: admin May 14, 2020 Leave a comment


I’m trying to implement OAuth2 login flow using Custom Tabs, but after login has been successful a 302 Redirect is retrieved with url as the following: “my.app:/oauth2/code?xxx”.

Now I have declared redirect URI in AndroidManifest to listen to this, but ERR_UNKNOWN_URL_SCHEME is seen :/


            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

I’ve tried different url-schemes to listen to, but none seems to be triggered to open my app.

How to&Answers:

The issue had to do with the identification happening in another app. So when I resumed the CustomTabs, somehow the context was lost. :/

Basically this is what we wanted to do:

MyApp -> CustomTabs -> Identify with other app (from redirect) -> Resume CustomTabs (loading screen) -> redirect to MyApp.

But since the second redirect couldn’t be made, we tried another angle for the problem.

Our solution that worked was to break up the flow for the authentication:

MyApp -> CustomTabs -> redirect to MyApp -> Identify with another app -> redirect to MyApp -> CustomTabs (loading screen) -> redirect to MyApp with result.

Hopefully this helps someone with similar issue at least.