Skip to content

Commit 395fc8d

Browse files
committed
OAuth w/ external user fix
1 parent 06312e4 commit 395fc8d

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

backend/onyx/auth/users.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,13 @@ async def oauth_callback(
493493
# Handle case where user has used product outside of web and is now creating an account through web
494494
if not user.role.is_web_login():
495495
# We must use the existing user in the session if it matches
496-
# the user we just got by email/oauth
497-
if user.id:
498-
user_by_session = await db_session.get(User, user.id)
499-
if user_by_session:
500-
user = user_by_session
496+
# the user we just got by email/oauth. Note that this only applies
497+
# to multi-tenant, due to the overwriting of the user_db
498+
if MULTI_TENANT:
499+
if user.id:
500+
user_by_session = await db_session.get(User, user.id)
501+
if user_by_session:
502+
user = user_by_session
501503

502504
await self.user_db.update(
503505
user,

0 commit comments

Comments
 (0)