Chrome扩展程序oAuth请求重定向页面未加载 [英] Chrome Extension oAuth Request Redirect Page Not Loading

查看:178
本文介绍了Chrome扩展程序oAuth请求重定向页面未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究与Google日历交互的Chrome扩展程序。我已经开源并且可以在GitHub上找到代码: https:/ /github.com/joshholat/Add-to-Calendar-Chrome-Extension



它需要使用Google的oAuth进行授权才能编辑用户日历。直到最近,这工作正常。但是,有一天它出于某种原因停止了工作。当我执行下面的代码时,它会从oauth中打开一个新的选项卡,该选项卡应该要求获得许可,但该页面从不加载,而是冻结在重定向...上。因此,我无法授权和测试我的代码。



想法?

  var oauth = ChromeExOAuth.initBackgroundPage({$ b $'request_url':'https://www.google.com/accounts/OAuthGetRequestToken',
'authorize_url':'https:// www.google.com/accounts/OAuthAuthorizeToken',
'access_url':'https://www.google.com/accounts/OAuthGetAccessToken',
'consumer_key':'anonymous',
'consumer_secret':'anonymous',
'scope':'http://www.google.com/calendar/feeds/',
'app_name':'将事件添加到Google日历'

});

oauth.authorize( function(){
alert(auth);
});

解决方案

在为manifest.json添加以下权限之后工作

 permissions:[
tabs,
https://www.google.com/


I'm working on a Chrome Extension that interacts with Google Calendar. I've open sourced it, and the code can be found on GitHub: https://github.com/joshholat/Add-to-Calendar-Chrome-Extension

It needs to authorize with Google's oAuth in order to be able to edit the users calendar. Until recently, that was working fine. However, one day it for some reason stopped working. When I do the following code, it opens a new tab from oauth that is supposed to ask for permission however the page never loads but rather freezes on "Redirecting...". Therefore, there's no way for me to authorize and test my code.

Ideas?

var oauth = ChromeExOAuth.initBackgroundPage({
 'request_url': 'https://www.google.com/accounts/OAuthGetRequestToken',
 'authorize_url': 'https://www.google.com/accounts/OAuthAuthorizeToken',
 'access_url': 'https://www.google.com/accounts/OAuthGetAccessToken',
 'consumer_key': 'anonymous',
 'consumer_secret': 'anonymous',
 'scope': 'http://www.google.com/calendar/feeds/',
 'app_name': 'Add Events to Google Calendar'

});

oauth.authorize(function() { alert("auth"); });

解决方案

I got it working after adding the following permissions to manifest.json

"permissions": [
  "tabs",
  "https://www.google.com/"
],

这篇关于Chrome扩展程序oAuth请求重定向页面未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆