gpt4 book ai didi

oauth-2.0 - Gmail API google.auth.exceptions.RefreshError 范围无效

转载 作者:行者123 更新时间:2023-12-05 02:08:56 32 4
gpt4 key购买 nike

我正在编写一个使用 gmail api 从邮箱下载报告的命令行工具。我正在使用 quickstart.py(转换为 python3)进行身份验证。但是,当 token 过期一段时间后无法刷新时,这会起作用。我得到:

File "/home/ayoub/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 248, in refresh_grant response_data = _token_endpoint_request(request, token_uri, body) File "/home/ayoub/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 124, in _token_endpoint_request _handle_error_response(response_body) File "/home/ayoub/.local/lib/python3.6/site-packages/google/oauth2/_client.py", line 60, in _handle_error_response raise exceptions.RefreshError(error_details, response_body) google.auth.exceptions.RefreshError: ('invalid_scope: Some requested scopes were invalid. {invalid=[a, c, e, g, h, i, l, m, ., /, o, p, s, t, :]}', '{\n "error": "invalid_scope",\n "error_description": "Some requested scopes were invalid. {invalid\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',...]

关于oauth-2.0 - Gmail API google.auth.exceptions.RefreshError 范围无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60329078/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com