mirror of
https://github.com/open-webui/open-webui
synced 2025-03-16 18:38:44 +00:00
fix: get userinfo from endpoint, not only from token
as was suggested by @alvarolopez in #6262
This commit is contained in:
parent
c57ef980fb
commit
1b5ac834ef
@ -139,6 +139,11 @@ class OAuthManager:
|
|||||||
log.warning(f"OAuth callback error: {e}")
|
log.warning(f"OAuth callback error: {e}")
|
||||||
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
||||||
user_data: UserInfo = token["userinfo"]
|
user_data: UserInfo = token["userinfo"]
|
||||||
|
if not user_data:
|
||||||
|
user_data: UserInfo = await client.userinfo(token=token)
|
||||||
|
if not user_data:
|
||||||
|
log.warning(f"OAuth callback failed, user data is missing: {token}")
|
||||||
|
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_CRED)
|
||||||
|
|
||||||
sub = user_data.get("sub")
|
sub = user_data.get("sub")
|
||||||
if not sub:
|
if not sub:
|
||||||
|
Loading…
Reference in New Issue
Block a user