簡體   English   中英

無法通過適用於Android的Google+登錄獲取授權碼:INVALID_SCOPE

[英]Unable to get Authorization Code with Google+ Sign-in for Android: INVALID_SCOPE

我正在嘗試按照這些說明檢索要在我的服務器端使用的授權代碼。 服務器的客戶端ID共享我的Android客戶端ID的同一項目。

我可以檢索訪問令牌,但不能檢索授權代碼:

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 my_email_address@company.com oauth2:server:client_id:314345278679.apps.googleusercontent.com:api_scope:https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email

有任何想法嗎?

您缺少來自示波器的https://www.googleapis.com/auth/plus.login 我嘗試了你的代碼並獲得INVALID_SCOPE而沒有plus.login,但它可以正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM