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

我正在使用google-api-python-client和imapclient库来尝试获取对Gmail的IMAP访问。


通过身份验证流程时,出现“无效范围”错误。我已经尝试过https://mail.google.com和https://mail.google.com/mail/feed/atom作为范围。


这是我想做的事情:


from oauth2client.appengine import OAuth2Decorator


SCOPE = "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)

一只斗牛犬
浏览 202回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python