From 91df1c56b23bbf616aa8a191d80a489ecd905fd6 Mon Sep 17 00:00:00 2001 From: Rodrigo Agundez Date: Thu, 16 Jan 2025 19:32:35 +0800 Subject: [PATCH] Add headers --- backend/open_webui/utils/oauth.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 48fc1d740..23b98494a 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -261,8 +261,14 @@ class OAuthManager: if picture_url: # Download the profile image into a base64 string try: + access_token = token.get("access_token") + get_kwargs = {} + if access_token: + get_kwargs["headers"] = { + "Authorization": f"Bearer {access_token}", + } async with aiohttp.ClientSession() as session: - async with session.get(picture_url) as resp: + async with session.get(picture_url, **get_kwargs) as resp: picture = await resp.read() base64_encoded_picture = base64.b64encode( picture