【发布时间】:2013-09-15 16:42:17
【问题描述】:
我正在使用 google 身份验证,但不断收到来源不匹配的问题。我正在工作的项目具有由用户生成的子域。所以例如可以有:
john.example.com
henry.example.com
larry.example.com
在我的应用设置中,我的来源之一是 http://*.example.com,但我得到一个来源不匹配。有没有办法解决这个问题?顺便说一句,我的代码如下所示:
gapi.auth.authorize({
client_id : 'xxxxx.apps.googleusercontent.com',
scope : ['https://www.googleapis.com/auth/plus.me',
state: 'http://henry.example.com',
'https://www.googleapis.com/auth/userinfo.email', 'https://www.googleapis.com/auth/userinfo.profile'],
immediate : false
}, function(result) {
if (result != null) {
gapi.client.load('oath2', 'v2', function() {
console.log(gapi.client);
gapi.client.oauth2.userinfo.get().execute(function(resp) {
console.log(resp);
});
});
}
});
【问题讨论】:
-
根据stackoverflow.com/questions/13652062/…,不支持通配符域作为重定向URL
-
答案是使用状态,但我尝试过没有用,除非它实施错误。
-
标签: javascript oauth google-oauth google-authentication