Я строю интеграцию с Github, используя библиотеку Authlib, и мне нужно обновить токены доступа. Я вызываю Refresh_token() в библиотеке Authlib следующим образом:
Traceback (most recent call last):
File "", line 1, in
File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 264, in refresh_token
auth=auth, **session_kwargs)
File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 275, in _refresh_token
token = self.parse_response_token(resp.json())
File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 380, in parse_response_token
self.handle_error(error, description)
File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/integrations/requests_client/oauth2_session.py", line 117, in handle_error
raise OAuthError(error_type, error_description)
authlib.integrations.base_client.errors.OAuthError: bad_refresh_token: The refresh token passed is incorrect or expired.
Я не удалил приложение Github между получением токена доступа и попыткой его обновления. Есть идеи, что я могу делать не так?
Я строю интеграцию с Github, используя библиотеку Authlib, и мне нужно обновить токены доступа. Я вызываю Refresh_token() в библиотеке Authlib следующим образом: [code]my_token = {'refresh_token':'a_long_refresh_token_string', 'access_token': "a_long_access_token", 'expires_at': 1596745728.0, 'expires_in': 28800.0}
# Tried this too, but generates the same error # new_token = oauth_session.refresh_token(url="https://github.com/login/oauth/access_token", client_id=client_id, client_secret=client_secret) [/code] Но это постоянно приводит к ошибке OAuthError. Вот полная трассировка стека: [code]Traceback (most recent call last): File "", line 1, in File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 264, in refresh_token auth=auth, **session_kwargs) File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 275, in _refresh_token token = self.parse_response_token(resp.json()) File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/oauth2/client.py", line 380, in parse_response_token self.handle_error(error, description) File "/root/user/dev/venvs/pyenv/lib64/python3.7/site-packages/authlib/integrations/requests_client/oauth2_session.py", line 117, in handle_error raise OAuthError(error_type, error_description) authlib.integrations.base_client.errors.OAuthError: bad_refresh_token: The refresh token passed is incorrect or expired. [/code] Я не удалил приложение Github между получением токена доступа и попыткой его обновления. Есть идеи, что я могу делать не так?