Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught ValueError thrown when credentials_store is missing a key #128

Open
gfinak opened this issue Aug 13, 2021 · 0 comments · May be fixed by #129
Open

Uncaught ValueError thrown when credentials_store is missing a key #128

gfinak opened this issue Aug 13, 2021 · 0 comments · May be fixed by #129

Comments

@gfinak
Copy link

gfinak commented Aug 13, 2021

We are using flask-oidc 1.4.
There this bug occurs at lines 457-465.

When the credentials store has no key for id_token["sub"] this throws an uncaught ValueError as line 443 returns None.

# when Google is the IdP, this happens after one hour
if time.time() >= id_token['exp']:
# get credentials from store
try:
credentials = OAuth2Credentials.from_json(
self.credentials_store[id_token['sub']])
except KeyError:
logger.debug("Expired ID token, credentials missing",
exc_info=True)
return self.redirect_to_auth_server(request.url)

Simply catching the error and redirecting solves the issue.

except ValueError:
                logger.debug("Credentials missing", exc_info=True)
                return self.redirect_to_auth_server(request.url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant