CustomTabs shows ERR_UNKNOWN_URL_SCHEME after 302 Redirect
Asked Answered
M

1

11

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 :/

<intent-filter>
            <data
                android:host="oauth2"
                android:scheme="my.app"
                android:pathPrefix="/code"
            />

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

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

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

Mucosa answered 30/6, 2017 at 7:33 Comment(3)
Shouldn't the proper redirect URL be my.app://oauth2/code?xxxBlinding
Do you really have a dot in your scheme?Tetrode
Yes, but that does not interfere when defining an scheme.Mucosa
M
0

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.

Mucosa answered 25/7, 2017 at 5:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.