puiterwijk / flask-oidc

OpenID Connect support for Flask
BSD 2-Clause "Simplified" License
157 stars 219 forks source link

Uncaught ValueError thrown when credentials_store is missing a key #128

Open gfinak opened 3 years ago

gfinak commented 3 years ago

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. https://github.com/puiterwijk/flask-oidc/blob/7f16e27b926fc12953d6b2ae78a9b9cc9b8d1769/flask_oidc/__init__.py#L438-L448

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)