get (insecure_transport) OAuth 2必须使用https与Heroku管理的CERT.我有一个



我正在尝试使用google sheets API服务,这需要HTTPS连接。我得到以下错误

Exception Type: InsecureTransportError at my_site/google/success/
Exception Value: (insecure_transport) OAuth 2 MUST utilize https.

我正在使用Heroku,并且在我的设置中显示为AMC Status: ok。我通过运行curl -vI https://my_site/google/success来验证我正在使用HTTPS返回:

SSL certificate verify ok

从我的角度来看,似乎我正在使用HTTPS,但我得到这个错误。我能做错什么吗?肯定是我配置错了,还有什么需要从故障排除中提供的吗?以下是完整的回溯:

traceback (most recent call last):
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/app/.heroku/python/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/google_api/views.py", line 56, in authorize_success
flow.fetch_token(authorization_response=code)
File "/app/.heroku/python/lib/python3.8/site-packages/google_auth_oauthlib/flow.py", line 286, in fetch_token
return self.oauth2session.fetch_token(self.client_config["token_uri"], **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/requests_oauthlib/oauth2_session.py", line 239, in fetch_token
self._client.parse_request_uri_response(
File "/app/.heroku/python/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/clients/web_application.py", line 203, in parse_request_uri_response
response = parse_authorization_code_response(uri, state=state)
File "/app/.heroku/python/lib/python3.8/site-packages/oauthlib/oauth2/rfc6749/parameters.py", line 256, in parse_authorization_code_response
raise InsecureTransportError()
import os 
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'

相关内容

  • 没有找到相关文章

最新更新