Gmail API Chrome扩展程序匿名功能错误

时间:2015-03-16 07:07:05

标签: javascript google-chrome-extension oauth-2.0 anonymous-function gmail-api

我想在此链接后使用Gmail API创建Google Chrome扩展程序:

http://developer.streak.com/2014/10/how-to-use-gmail-api-in-chrome-extension.html

我从这个链接下载了要点:

https://gist.github.com/omarstreak/7908035c91927abfef59

我遇到oauth2身份验证问题。当我加载扩展时,我在运行identity.getAuthToken时遇到错误"未经检查的runtime.lastError:OAuth2请求失败:.."当我查看错误的细节时,堆栈跟踪返回background.js:2(匿名函数),指向chrome.identity.getAuthToken函数。我使用的是有效的客户端ID。

我的background.js文件中调用的代码

//oauth2 auth
chrome.identity.getAuthToken(
     {'interactive': true},
    function(){
      //load Google's javascript client libraries
        window.gapi_onload = authorize;
        loadScript('https://apis.google.com/js/client.js');
}

);

从manifest.js

中调用background.js的代码
  "background": { "scripts": ["base64.js", "background.js"] 
  },

如何绕过调试此错误?

0 个答案:

没有答案
相关问题