0
我使用Google ApI v3。我想獲取用戶的聯繫人列表。谷歌聯繫人Api origin_mismatch
代碼
var clientId = 'XXX';
var apiKey = 'XXX';
var scopes = 'https://www.googleapis.com/auth/contacts.readonly';
$(document).on("click", ".js-google_contacts", function() {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth, 3);
});
function checkAuth() {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
}
function handleAuthResult(authResult) {
//handler
}
}
我在本地主機的工作,我已經配置的Oauth
AUTHORIZED JAVASCRIPT ORIGINS : **http://localhost:80**
AUTHORIZED REDIRECT URI : **http://localhost:80/oauth2callback**
,但結果是
400. That’s an error.
Error: origin_mismatch
origin=http://127.0.0.1
redirect_uri=postmessage
scope=https://www.googleapis.com/auth/contacts.readonly
response_type=token
immediate=false
include_granted_scopes=true
authuser=0
任何人可以幫助我嗎?
來源「可能」(沒有檢查自己)是字符串比較。所以http:// localhost:80可能不等同於http://127.0.0.1 – 2014-10-06 16:25:30