Ayo*_*del 3 oauth-2.0 google-oauth gmail-api
我正在编写一个命令行工具,它使用 gmail api 从邮箱下载报告。我正在使用quickstart.py(转换为python3)进行身份验证。但是,当令牌过期一段时间后无法刷新时,这种方法会起作用。我得到:
文件“/home/ayoub/.local/lib/python3.6/site-packages/google/oauth2/_client.py”,第 248 行,refresh_grant response_data = _token_endpoint_request(request, token_uri, body) 文件“/home/ayoub /.local/lib/python3.6/site-packages/google/oauth2/_client.py”,第 124 行,在 _token_endpoint_request _handle_error_response(response_body) 文件“/home/ayoub/.local/lib/python3.6/site- packages/google/oauth2/_client.py",第 60 行,在 _handle_error_response 中引发异常。RefreshError(error_details, response_body) google.auth.exceptions.RefreshError: ('invalid_scope: 某些请求的范围无效。{invalid=[a, c , e, g, h, i, l, m, ., /, o, p, s, t, :]}', '{\n "error": "invalid_scope",\n "error_description": "一些请求的范围无效。{无效\u003d[a, c, e, g, h, i, l, m, ., /, o, p, s, t, :]}",\n "error_uri": " http://code.google.com/apis/accounts/docs/OAuth2.html“\n }”)
我已确保我不会更改范围并创建了一个新的credentials.json 文件。我还尝试升级所有使用的库。有没有人遇到过这个或知道解决方案?谢谢你!
您收到的错误是由于范围声明不正确造成的。声明范围的适当方法是:
var SCOPES = ['SCOPE 1', 'SCOPE 2',...]
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5604 次 |
| 最近记录: |