在Android上使用Oauth2的未知协议

时间:2016-04-23 01:43:39

标签: java android oauth-2.0 android-manifest deep-linking

我正在尝试在Android上使用Oauth2进行身份验证,但我的应用程序仍然崩溃,因为它会引发以下错误:未知协议:kiactiv

见下文:

    04-23 02:34:11.440 19202-19202/android.kiactiv I/OAuthAndroid: shouldOverrideUrlLoading: kiactiv://oauth_callback?code=TOKEN
    04-23 02:34:11.441 19202-19202/android.kiactiv I/OAuthAndroid: url: kiactiv://oauth_callback?code=TOKEN, redirect: kiactiv://oauth_callback, callback: true



    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err: java.lang.IllegalArgumentException: java.net.MalformedURLException: Unknown protocol: kiactiv
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.google.api.client.http.GenericUrl.parseURL(GenericUrl.java:638)
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.google.api.client.http.GenericUrl.<init>(GenericUrl.java:114)
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl.<init>(AuthorizationCodeResponseUrl.java:99)
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.wuman.android.auth.OAuthDialogFragment$3.interceptUrlCompat(OAuthDialogFragment.java:361)
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.wuman.android.auth.OAuthDialogFragment$3.shouldOverrideUrlLoading(OAuthDialogFragment.java:316)
    04-23 02:34:11.448 19202-19202/android.kiactiv W/System.err:     at com.android.webview.chromium.WebViewContentsClientAdapter.shouldOverrideUrlLoading(WebViewContentsClientAdapter.java:336)

我的gradle文件包含以下库:

compile('com.google.api-client:google-api-client-android:1.20.0') {
    exclude group: 'com.google.android.google-play-services', module: 'google-play-services'
    exclude group: 'junit', module: 'junit'
    exclude group: 'com.google.android', module: 'android'
}
compile 'com.google.oauth-client:google-oauth-client-java6:1.20.0'
compile 'com.google.http-client:google-http-client-jackson:1.20.0'

我在清单文件中除了深层链接外:

<activity
            android:name="android.kiactiv.DeepLinkActivity"
            android:launchMode="singleTask"
            android:label="@string/app_name" >
            <intent-filter >
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <!-- Accepts URIs that begin with "kiactiv://oauth_callback” -->
                <data android:scheme="kiactiv" android:host="oauth_callback" />

            </intent-filter>
        </activity>

我的源代码与此one what I found on github非常相似:。我刚刚更换了信用卡和URL。

任何线索?

干杯

0 个答案:

没有答案