flask-oidc icon indicating copy to clipboard operation
flask-oidc copied to clipboard

Traceback on errors during the refresh process

Open abompard opened this issue 7 years ago • 2 comments

On Hubs I get this traceback sometimes:

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3.6/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1637, in full_dispatch_request
    rv = self.preprocess_request()
  File "/usr/lib/python3.6/site-packages/flask/app.py", line 1837, in preprocess_request
    rv = func()
  File "/usr/lib/python3.6/site-packages/flask_oidc/__init__.py", line 324, in _before_request
    self.authenticate_or_redirect()
  File "/usr/lib/python3.6/site-packages/flask_oidc/__init__.py", line 362, in authenticate_or_redirect
    credentials.refresh(httplib2.Http())
  File "/usr/lib/python3.6/site-packages/oauth2client/client.py", line 545, in refresh
    self._refresh(http)
  File "/usr/lib/python3.6/site-packages/oauth2client/client.py", line 749, in _refresh
    self._do_refresh_request(http)
  File "/usr/lib/python3.6/site-packages/oauth2client/client.py", line 786, in _do_refresh_request
    self.access_token = d['access_token']
KeyError: 'access_token'

I've printed the value of the variable d and it's {'error_description': 'Something went wrong refreshing', 'error': 'invalid_grant'}.

abompard avatar Jan 24 '18 21:01 abompard

Apparently the server sometimes returns an error but with a HTTP 200 code, which sends the execution into the wrong code path.

abompard avatar Jan 24 '18 21:01 abompard

I'm experiencing this issue as well. @abompard did you manage to find a fix or a workaround?

bkabrda avatar Jul 10 '18 11:07 bkabrda