我嘗試使用谷歌聯繫人API導入用戶的Gmail聯繫人。這適用於我的Gmail,但是當其他人試圖與以下錯誤消息登錄失敗:谷歌聯繫人API無效的範圍,但應用程序並不需要審覈 - 聯繫人API
Error: invalid_scope
This app hasn't been verified to access: {invalid = [https://www.googleapis.com/auth/contacts]} Please contact the developer for assistance. Are you the developer? If this project needs these scopes, sign in to an account with access to edit your project and try again. If not, contact the developer for help.
因爲這個消息的,我做了一些研究,發現這question這表明該應用程序需要進行審查。然後我提交了我的應用程序verification。不過,我收到一封電子郵件,說我的應用不需要谷歌驗證。
Thank you for submitting the developer verification form. Based on the information you provided, you have access to the scopes that you are planning to use. If you add any more scopes in the future, you may have to go through verification.
我請求範圍是https://www.google.com/m8/feeds/
。
此範圍是否需要谷歌批准?
我使用GAPI庫,下面是我的代碼:
function start() {
var auth_obj = {
clientId: currentUser.GOOGLE_APP_ID,
scope: 'https://www.google.com/m8/feeds/'
}
gapi.client.init(auth_obj).then(function() {
gapi.auth2.getAuthInstance().isSignedIn.listen(updateSigninStatus);
updateSigninStatus(gapi.auth2.getAuthInstance().isSignedIn.get());
})
};
gapi.load('client:auth2', start);
function getContacts() {
var access_token = gapi.auth2.getAuthInstance().currentUser.get().getAuthResponse().access_token
var url = "https://www.google.com/m8/feeds/contacts/default/"
url += "thin?alt=json&access_token=" + access_token
url += "&max-results=500&v=3.0"
$.get(url)
}
您正在使用哪個庫?或者你只是在做手動HTTP請求?如果是後者,你有一些代碼可以分享嗎?此外,您的聯繫人API不需要批准即可使用。它只需要批准提高每天2000萬個查詢的默認限制。 –
@ BlakeO'Hare更新了代碼。我正在使用gapi庫 – user2954587
你可以檢查auth令牌的值嗎? (儘管這裏不要粘貼它)。確保它以「ya29 ...」或類似的東西開頭。錯誤是來自OAuth端點還是來自Contacts API端點? –