mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #21048] [CLOSED] feat: Enable OAuth token forwarding with configurable token type for OpenAI-compatible backends #25901
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/21048
Author: @pivu-sbab
Created: 1/29/2026
Status: ❌ Closed
Base:
dev← Head:feat/conf-oauth-token-forward📝 Commits (10+)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/devd95f533Merge pull request #19729 from open-webui/deva7271530.6.43 (#20093)6adde20Merge pull request #20394 from open-webui/devf9b0534Merge pull request #20522 from open-webui/dev📊 Changes
3 files changed (+34 additions, -15 deletions)
View changed files
📝
backend/open_webui/config.py(+8 -1)📝
backend/open_webui/routers/openai.py(+8 -8)📝
src/lib/components/AddConnectionModal.svelte(+18 -6)📄 Description
✅ Description
Enhances the OAuth integration by allowing system OAuth tokens (
access_tokenorid_token) to be forwarded to OpenAI-compatible backend services. This enables backend services to receive the OAuth token and implement custom authorization logic based on token claims (such as user groups, roles, etc.) for/v1/modelsand/v1/chat/completionsendpoints.✅ Dependencies
No new dependencies.
✅ Testing
ID Tokenoption)Configuration example, either as an environment variable:
Or through the Admin Panel:
I have confirmed that my OpenAI service receives either the access_token (by default) or the id_token (if configured like above).
✅ Agentic AI Code and Code Review
AI has been used, but all suggestion has been rewritten and modified by me (human). Everything has also been manually tested by me, and code reviewed by two other colleagues in my team.
We have strived to have the most minimal git diff that fulfills the needs for this feature, no more, no less.
✅ Changelog
Description
(See PR description above)
Added
token_typeconfiguration option to thesystem_oauthauthentication, supporting bothaccess_token(default) andid_tokenOPENAI_API_CONFIGSenvironment variable, used in containerized deploymentsChanged
send_get_request()to re-useget_headers_and_cookies(), instead of using the hardcoded Bearer key.system_oauthauthentication to support configurable token type selection, allowing backend OpenAI services to receive OAuth Access tokens or ID tokensBreaking Changes
token_typedefaults toaccess_tokenwhen not specified, andOPENAI_API_CONFIGSparsing gracefully falls back to empty configuration on errors✅ Additional Information
Contributor License Agreement
By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.