2013-06-18 8 views
5

these instructionsの後にサーバー側で使用する認証コードを取得しようとしています。サーバーのクライアントIDは、AndroidクライアントIDと同じプロジェクトを共有します。Android用のGoogle+ログインで承認コードを取得できません:INVALID_SCOPE

私は認可コードアクセストークンを取得することはできませんが、(代わりにトークンの認証コードを取得するために)代替スコープを使用する

String mScopes = "oauth2:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"; 
//String mScopes = "oauth2:server:client_id:314345278679.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email"; 
Bundle mAppActivities = new Bundle(); 
mAppActivities.putString(GoogleAuthUtil.KEY_REQUEST_VISIBLE_ACTIVITIES, ""); 
String authorizationToken = GoogleAuthUtil.getToken(LoginActivity.this, mPlusClient.getAccountName(), mScopes, mAppActivities); 

にコメントを外すには、次のエラーを生成します。

I/GLSUser (15293): GLS error: INVALID_SCOPE [email protected] oauth2:server:client_id:314345278679.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email 

アイデア

答えて

11

あなたのスコープにはhttps://www.googleapis.com/auth/plus.loginがありません。あなたのコードを試して、plus.loginを使わないでINVALID_SCOPEを取得しましたが、うまく動作します。

+0

ありがとうございます!私はこれをもう一度試したと思ったが、おそらく間違った範囲を使用していた。 –

+3

ちょっと@Lee、これは私のために働いていましたが、ほんの数日前に動作を停止しましたが、今度はこのエラーをスローしますcom.google.android.gms.auth.GoogleAuthException:Unknown。どんな考え?私のスコープに何か問題がありますか? https://gist.github.com/lawloretienne/7351151 – toobsco42

+1

hm、私もunknowエラーが出て、動作する方法が見つからないようです – Stals

関連する問題