谷歌联系人Api origin_mismatch
问题描述:
我使用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