Skip to content

Commit

Permalink
Prevent automatic oauth login after logout (#1362)
Browse files Browse the repository at this point in the history
Add prompt=consent/login to display oauth consent page on login.

---------

Co-authored-by: Mathijs de Bruin <[email protected]>
  • Loading branch information
ModEnter and dokterbob authored Oct 2, 2024
1 parent 1d3ffd4 commit 11664b3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/chainlit/oauth_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self):
self.client_secret = os.environ.get("OAUTH_GITHUB_CLIENT_SECRET")
self.authorize_params = {
"scope": "user:email",
"prompt": "consent",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -95,6 +96,7 @@ def __init__(self):
"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
"response_type": "code",
"access_type": "offline",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -162,6 +164,7 @@ def __init__(self):
"response_type": "code",
"scope": "https://graph.microsoft.com/User.Read",
"response_mode": "query",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -246,6 +249,7 @@ def __init__(self):
"scope": "https://graph.microsoft.com/User.Read https://graph.microsoft.com/openid",
"response_mode": "form_post",
"nonce": nonce,
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -325,6 +329,7 @@ def __init__(self):
"response_type": "code",
"scope": "openid profile email",
"response_mode": "query",
"prompt": "login",
}

def get_authorization_server_path(self):
Expand Down Expand Up @@ -396,6 +401,7 @@ def __init__(self):
"response_type": "code",
"scope": "openid profile email",
"audience": f"{self.original_domain}/userinfo",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -453,6 +459,7 @@ def __init__(self):
"response_type": "code",
"scope": "openid profile email",
"audience": f"{self.domain}/userinfo",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -511,6 +518,7 @@ def __init__(self):
"response_type": "code",
"client_id": self.client_id,
"scope": "openid profile email",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down Expand Up @@ -579,6 +587,7 @@ def __init__(self):
self.authorize_params = {
"scope": "openid profile email",
"response_type": "code",
"prompt": "login",
}

async def get_token(self, code: str, url: str):
Expand Down
1 change: 1 addition & 0 deletions frontend/src/components/molecules/auth/AuthLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const AuthLogin = ({
setErrorState(undefined);
formik.resetForm();
}, [showSignIn]);

useEffect(() => {
setErrorState(error);
}, [error]);
Expand Down

0 comments on commit 11664b3

Please sign in to comment.