1

道標ライブラリを使用してAndroidにOauthを実装する際に問題が発生しました。アクセスを許可した後にアプリケーション自体に戻る必要がある最後の部分を除いて、すべて問題ありません。

以下は、マニフェストでのアクティビティコールバック宣言です。

<activity android:name="ro.locationsApp.android.login.LoginScreenActivity" 
        android:screenOrientation="portrait"
        android:launchMode="singleTask">
        <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="http" android:host="myCallbackHost"/>
        </intent-filter>
    </activity>

そして、次のようなコードからコールバックURLを渡します。

new OAuthHelper("mySite", "secret", 
        "https://www.googleapis.com/auth/userinfo.profile", "http://myCallbackHost");

myCallbackHostは、実際の機能的なリンクです(Webサイト認証後のコールバックにも使用されます。モバイルも必要です)。

問題は、この後、私のAndroidアプリが呼び出されないことです。私も試しました

<data android:scheme="customScheme"/>

new OAuthHelper("mySite", "secret", 
    "https://www.googleapis.com/auth/userinfo.profile", "customScheme:///");   

しかし、成功しませんでした。

ありがとう、

アレックス。

4

1 に答える 1

0

httpを他のものに変更すると機能します。

これが私のマニフェストが今どのように見えるかです:

<activity android:name="ro.locationsApp.android.login.LoginScreenActivity" 
    android:screenOrientation="portrait"
    android:launchMode="singleTask">
    <intent-filter>
        <category android:name="android.intent.category.LUNCHER" />
    </intent-filter>
    <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="alex" android:host="me"/>
    </intent-filter>
</activity>

およびコード:

new OAuthHelper("mySite", "secret", 
"https://www.googleapis.com/auth/userinfo.profile", "alex://me"); 

チャームのように機能します。

于 2012-06-08T20:12:56.430 に答える