我使用的oauth2扩展到能够从访问铬扩展在谷歌数据 http://smus.com/oauth2-chrome-extensions/如何在Chrome扩展中为OAuth2提供重定向网址?
我修改了manifest.json中,进入在JS中的数据,并尝试进行身份验证,但得到一个错误 - 回应:
redirect_uri_mismatch [...] REDIRECT_URI = http://www.google.com/robots.txt
我很想该网址添加到允许的重定向的URL,但使用时有没有这样的选项“呐tive应用程序“或”chrome应用程序“我只能在Google的开发控制台上添加重定向URI。
任何方法来解决这个问题?我的manifest.json的
部分:
"permissions": [
"http://ajax.googleapis.com/",
"storage",
"https://accounts.google.com/o/oauth2/token"
],
"content_scripts":
[{
"matches": ["https://plus.google.com/*"],
"js": [
"setup/js/jquery-1.10.2.min.js",
"date.js"]
},
{
"matches": ["http://www.google.com/robots.txt*"],
"js": ["oauth2/oauth2_inject.js"],
"run_at": "document_start"
}],
我的JS代码:
var googleAuth = new OAuth2('google', {
client_id: 'WHATEVER.apps.googleusercontent.com',
client_secret: 'HIDDEN',
api_scope: 'https://www.googleapis.com/auth/tasks'
});
function GetAuth()
{
googleAuth.authorize(function() {
alert('yippee ki yay!');
});
}
(当然 “隐藏” 和 “无所谓” 包含有效值)
我不能相信它是多么容易与铬身份工作... :)感谢朋友。 –
只要注意用户需要登录到chrome而旧的方法没有。 –
它不再工作,重定向到支持页面 – Poutrathor