我已将Gmail API服务集成到我的API中。在OAuth
的Gmail API流程中,为我提供了刷新令牌,该令牌用于在每次访问令牌到期时刷新访问令牌。
现在,我为Google日历创建了另一项服务,该服务独立于Gmail API服务。在这里,我使用Google日历范围执行OAuth
,但是这次没有获得刷新令牌。
我的日历令牌过期后,我尝试使用Gmail刷新令牌进行刷新,但出现以下错误:
lib/python3.7/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: Bad Request', '{\n "error": "invalid_scope",\n "error_description": "Bad Request"\n}')
据此,我了解到Google提供的刷新令牌与您定义的范围有关。 如果我想获取其他范围的刷新令牌,该怎么办?