What's the scope for Gmail's OAuth2 IMAP access? <p>I'm using <a href="http://code.google.com/p/google-api-python-client/" rel="nofollow">google-api-python-client</a> and <a href="https://bitbucket.org/mjs0/imapclient" rel="nofollow">imapclient</a> libraries to try get IMAP access to Gmail.</p> <p>When going through the authentication flow, I'm getting "invalid scope" errors. I've tried both <code>https://mail.google.com</code> and <code>https://mail.google.com/mail/feed/atom</code> as scopes.</p> <p>Here's what I'm trying to do:</p> <pre><code>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") </code></pre> <p>And here's the stacktrace:</p> <pre><code>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) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1102, in __call__ return handler.dispatch() File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 572, in dispatch return self.handle_exception(e, self.app.debug) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 570, in dispatch return method(*args, **kwargs) File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/ext/webapp/util.py", line 68, in check_login handler_method(self, *args) File "/Users/John/Projects/my-app/backend/oauth2client/appengine.py", line 787, in get credentials = decorator.flow.step2_exchange(self.request.params) File "/Users/John/Projects/my-app/backend/oauth2client/util.py", line 128, in positional_wrapper return wrapped(*args, **kwargs) File "/Users/John/Projects/my-app/backend/oauth2client/client.py", line 1310, in step2_exchange raise FlowExchangeError(error_msg) FlowExchangeError: invalid_scope </code></pre>