diff --git a/lenticular_cloud/views/oauth2.py b/lenticular_cloud/views/oauth2.py index c1320bb..3767731 100644 --- a/lenticular_cloud/views/oauth2.py +++ b/lenticular_cloud/views/oauth2.py @@ -1,5 +1,5 @@ from authlib.integrations.flask_client import OAuth -from authlib.integrations.base_client.errors import MismatchingStateError +from authlib.integrations.base_client.errors import MismatchingStateError, OAuthError from flask import Flask, Blueprint, Response, session, request, redirect, url_for from flask_login import login_user, logout_user, current_user from flask.typing import ResponseReturnValue @@ -43,6 +43,9 @@ def authorized() -> ResponseReturnValue: except MismatchingStateError: logger.warning("MismatchingStateError redirect user") return redirect(url_for('oauth2.login')) + except OAuthError as e: + logger.warning(f"OAuthError redirect user {e}") + return redirect(url_for('oauth2.login')) if token is None: return 'bad request', 400 session['token'] = token