为了账号安全,请及时绑定邮箱和手机立即绑定

Gmail的OAuth2 IMAP访问范围是什么?

Gmail的OAuth2 IMAP访问范围是什么?

一只斗牛犬 2021-03-05 11:47:19
我正在使用google-api-python-client和imapclient库来尝试获取对Gmail的IMAP访问。通过身份验证流程时,出现“无效范围”错误。我已经尝试过https://mail.google.com和https://mail.google.com/mail/feed/atom作为范围。这是我想做的事情:from oauth2client.appengine import OAuth2DecoratorSCOPE = "https://mail.google.com"# SCOPE = "https://mail.google.com/mail/feed/atom"oauth2decorator_gmail = OAuth2Decorator(client_id="CLIENT_ID",                                   client_secret="CLIENT_SECRET",                                   scope=SCOPE,                                   callback_path='/mycallbackurl')class AuthenticateSyncServices(webapp2.RequestHandler):    @oauth2decorator_gmail.oauth_required    def get(self):        self.response.write("Authenticated")这是堆栈跟踪:INFO     2013-06-06 08:56:36,686 client.py:1304] Failed to retrieve access token: {  "error" : "invalid_scope"}Traceback (most recent call last):  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1536, in __call__    rv = self.handle_exception(request, response, e)  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1530, in __call__    rv = self.router.dispatch(request, response)  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher    return route.handler_adapter(request, response)
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 200 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信