From bd71792d23f9ba738ae39d84a84ca74712cf81fa Mon Sep 17 00:00:00 2001 From: silentoplayz Date: Mon, 27 Jul 2026 18:33:03 -0400 Subject: [PATCH] feat: attribute SSO logouts in the auth.logout event payload --- backend/open_webui/routers/auths.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index d9f6b022ba..b14e789ad6 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -950,6 +950,9 @@ async def signout(request: Request, response: Response, db: AsyncSession = Depen if token is None: token = request.cookies.get('token') + oauth_session_id = request.cookies.get('oauth_session_id') + session = await OAuthSessions.get_session_by_id(oauth_session_id, db=db) if oauth_session_id else None + if token: actor = None data = decode_token(token) @@ -962,18 +965,16 @@ async def signout(request: Request, response: Response, db: AsyncSession = Depen actor=actor, subject_id=actor.id if actor else None, subject_type='user' if actor else None, + **({'source': 'oauth', 'data': {'auth_method': 'oauth', 'provider': session.provider}} if session else {}), ) response.delete_cookie('token') response.delete_cookie('oui-session') response.delete_cookie('oauth_id_token') - oauth_session_id = request.cookies.get('oauth_session_id') if oauth_session_id: response.delete_cookie('oauth_session_id') - session = await OAuthSessions.get_session_by_id(oauth_session_id, db=db) - # If a custom end_session_endpoint is configured (e.g. AWS Cognito), redirect # there directly instead of attempting OIDC discovery. openid_end_session_endpoint = await Config.get('oauth.end_session_endpoint')