[PR #22864] [CLOSED] fix: register OAUTH_SUB_CLAIM on app.state.config in main.py #26894

Closed
opened 2026-04-20 06:45:43 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/22864
Author: @18jreid
Created: 3/19/2026
Status: Closed

Base: mainHead: fix/oauth-sub-claim-missing-config


📝 Commits (1)

  • 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>
GiteaMirror added the pull-request label 2026-04-20 06:45:43 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#26894