oauth2.py问题获取gmail凭据

时间:2017-04-25 19:57:37

标签: oauth-2.0 gmail

我正在尝试获取Google Gmail帐号:

OAUTH_TOKEN = ''  # XXX: Obtained with xoauth.py
OAUTH_TOKEN_SECRET = ''  # XXX: Obtained with xoauth.py
GMAIL_ACCOUNT = ''  # XXX: Your Gmail address - example@gmail.com

https://github.com/google/gmail-oauth2-tools/wiki/OAuth2DotPyRunThrough

我尝试使用此命令:

$ python oauth2.py --generate_oauth2_token --client_id=364545978226.apps.googleusercontent.com --client_secret=zNrNsBzOOnQy8_O-8LkofeTR
To authorize token, visit this url and follow the directions:
  https://accounts.google.com/o/oauth2/auth?client_id=364545978226.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F
Enter verification code: 

当我尝试访问URI时:

https://accounts.google.com/o/oauth2/auth?client_id=364545978226.apps.googleusercontent.com&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&scope=https%3A%2F%2Fmail.google.com%2F

我收到错误 enter image description here

1 个答案:

答案 0 :(得分:0)

在'oauth2.py'中,我必须使用从Google的Gmail应用访问屏幕返回的'client_id'和'client_secret'。

enter image description here