b56e0aa fix: register OAUTH_SUB_CLAIM on app.state.config in main.py
📊 Changes
1 file changed (+2 additions, -0 deletions)
View changed files
📝backend/open_webui/main.py (+2 -0)
📄 Description
Summary
OAUTH_SUB_CLAIM is defined in config.py and used in the token_exchange endpoint (routers/auths.py:1349) via request.app.state.config.OAUTH_SUB_CLAIM, but was never imported or assigned in main.py
This causes an AttributeError: Config key 'OAUTH_SUB_CLAIM' not found on every token exchange request
Adds OAUTH_SUB_CLAIM to the config import block and registers it on app.state.config alongside the other OAuth claim configs (OAUTH_ROLES_CLAIM, OAUTH_EMAIL_CLAIM, OAUTH_PICTURE_CLAIM, OAUTH_USERNAME_CLAIM)
Test plan
Configure OAUTH_SUB_CLAIM env var and verify token exchange no longer throws AttributeError
Verify token exchange works without OAUTH_SUB_CLAIM set (fallback to default sub claim)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.
## 📋 Pull Request Information
**Original PR:** https://github.com/open-webui/open-webui/pull/22864
**Author:** [@18jreid](https://github.com/18jreid)
**Created:** 3/19/2026
**Status:** ❌ Closed
**Base:** `main` ← **Head:** `fix/oauth-sub-claim-missing-config`
---
### 📝 Commits (1)
- [`b56e0aa`](https://github.com/open-webui/open-webui/commit/b56e0aa3d413ca82b2ed15fb0b99183e90d7e969) fix: register OAUTH_SUB_CLAIM on app.state.config in main.py
### 📊 Changes
**1 file changed** (+2 additions, -0 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/main.py` (+2 -0)
</details>
### 📄 Description
## Summary
- `OAUTH_SUB_CLAIM` is defined in `config.py` and used in the `token_exchange` endpoint (`routers/auths.py:1349`) via `request.app.state.config.OAUTH_SUB_CLAIM`, but was never imported or assigned in `main.py`
- This causes an `AttributeError: Config key 'OAUTH_SUB_CLAIM' not found` on every token exchange request
- Adds `OAUTH_SUB_CLAIM` to the config import block and registers it on `app.state.config` alongside the other OAuth claim configs (`OAUTH_ROLES_CLAIM`, `OAUTH_EMAIL_CLAIM`, `OAUTH_PICTURE_CLAIM`, `OAUTH_USERNAME_CLAIM`)
## Test plan
- [ ] Configure `OAUTH_SUB_CLAIM` env var and verify token exchange no longer throws `AttributeError`
- [ ] Verify token exchange works without `OAUTH_SUB_CLAIM` set (fallback to default `sub` claim)
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/22864
Author: @18jreid
Created: 3/19/2026
Status: ❌ Closed
Base:
main← Head:fix/oauth-sub-claim-missing-config📝 Commits (1)
b56e0aafix: register OAUTH_SUB_CLAIM on app.state.config in main.py📊 Changes
1 file changed (+2 additions, -0 deletions)
View changed files
📝
backend/open_webui/main.py(+2 -0)📄 Description
Summary
OAUTH_SUB_CLAIMis defined inconfig.pyand used in thetoken_exchangeendpoint (routers/auths.py:1349) viarequest.app.state.config.OAUTH_SUB_CLAIM, but was never imported or assigned inmain.pyAttributeError: Config key 'OAUTH_SUB_CLAIM' not foundon every token exchange requestOAUTH_SUB_CLAIMto the config import block and registers it onapp.state.configalongside the other OAuth claim configs (OAUTH_ROLES_CLAIM,OAUTH_EMAIL_CLAIM,OAUTH_PICTURE_CLAIM,OAUTH_USERNAME_CLAIM)Test plan
OAUTH_SUB_CLAIMenv var and verify token exchange no longer throwsAttributeErrorOAUTH_SUB_CLAIMset (fallback to defaultsubclaim)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.