302重定向后,CustomTabs显示ERR_UNKNOWN_URL_SCHEME。

11

我正在尝试使用自定义选项卡实现OAuth2登录流程,但是在登录成功后,检索到一个带有以下url的302重定向:"my.app:/oauth2/code?xxx"。

现在我已经在AndroidManifest中声明了重定向URI以便监听此问题,但是看到ERR_UNKNOWN_URL_SCHEME:/。

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

我已经尝试了不同的URL方案来监听,但似乎没有触发打开我的应用程序。


正确的重定向URL不应该是 my.app://oauth2/code?xxx 吗? - pellucide
你的方案中真的有一个点吗? - maxoumime
是的,但这并不会干扰定义方案。 - Henric
1个回答

0

问题与在另一个应用程序中进行的身份验证有关。因此,当我恢复CustomTabs时,某种程度上丢失了上下文。: /

基本上这就是我们想做的事情:

MyApp -> CustomTabs -> 通过重定向与其他应用程序进行身份验证 -> 恢复CustomTabs(加载屏幕) -> 重定向到MyApp。

但由于无法进行第二次重定向,我们尝试了解决问题的另一种方法。

我们采用的解决方案是打破身份验证的流程:

MyApp -> CustomTabs -> 重定向到MyApp -> 与另一个应用程序进行身份验证 -> 重定向到MyApp -> CustomTabs(加载屏幕) -> 使用结果重定向到MyApp。

希望这能至少对类似问题有所帮助的人。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接