Skip to content

Commit d6a9efc

Browse files
committed
refac
1 parent b3e56e0 commit d6a9efc

2 files changed

Lines changed: 4 additions & 7 deletions

File tree

backend/open_webui/config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,6 @@ def google_oauth_register(oauth: OAuth):
687687
return client
688688

689689
OAUTH_PROVIDERS['google'] = {
690-
'redirect_uri': GOOGLE_REDIRECT_URI.value,
691690
'register': google_oauth_register,
692691
}
693692

@@ -708,7 +707,6 @@ def microsoft_oauth_register(oauth: OAuth):
708707
return client
709708

710709
OAUTH_PROVIDERS['microsoft'] = {
711-
'redirect_uri': MICROSOFT_REDIRECT_URI.value,
712710
'picture_url': MICROSOFT_CLIENT_PICTURE_URL.value,
713711
'register': microsoft_oauth_register,
714712
}
@@ -733,7 +731,6 @@ def github_oauth_register(oauth: OAuth):
733731
return client
734732

735733
OAUTH_PROVIDERS['github'] = {
736-
'redirect_uri': GITHUB_CLIENT_REDIRECT_URI.value,
737734
'register': github_oauth_register,
738735
'sub_claim': 'id',
739736
}
@@ -775,7 +772,6 @@ def oidc_oauth_register(oauth: OAuth):
775772

776773
OAUTH_PROVIDERS['oidc'] = {
777774
'name': OAUTH_PROVIDER_NAME.value,
778-
'redirect_uri': OPENID_REDIRECT_URI.value,
779775
'register': oidc_oauth_register,
780776
}
781777

backend/open_webui/utils/oauth.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,12 +1354,13 @@ async def handle_login(self, request, provider):
13541354
if provider not in OAUTH_PROVIDERS:
13551355
raise HTTPException(404)
13561356
# If the provider has a custom redirect URL, use that, otherwise automatically generate one
1357-
redirect_uri = OAUTH_PROVIDERS[provider].get('redirect_uri') or request.url_for(
1358-
'oauth_login_callback', provider=provider
1359-
)
13601357
client = self.get_client(provider)
13611358
if client is None:
13621359
raise HTTPException(404)
1360+
redirect_uri = (
1361+
(client.server_metadata or {}).get('redirect_uri')
1362+
or request.url_for('oauth_login_callback', provider=provider)
1363+
)
13631364

13641365
kwargs = {}
13651366
if auth_manager_config.OAUTH_AUDIENCE:

0 commit comments

Comments
 (0)