mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 10:34:13 -05:00
[PR #17619] [CLOSED] Feat: Add separate Client ID for Personal OneDrive to fix authentication #24493
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/17619
Author: @Classic298
Created: 9/20/2025
Status: ❌ Closed
Base:
dev← Head:onedrive-business-personal📝 Commits (3)
20de67cUpdate config.py297a041Update main.pyff5c2d4Update onedrive-file-picker.ts📊 Changes
3 files changed (+45 additions, -28 deletions)
View changed files
📝
backend/open_webui/config.py(+6 -0)📝
backend/open_webui/main.py(+2 -0)📝
src/lib/utils/onedrive-file-picker.ts(+37 -28)📄 Description
PR Title: Feat: Add separate Client ID for Personal OneDrive to fix authentication
PR Description:
This pull request resolves a long-standing architectural flaw in the Microsoft OneDrive integration, as detailed in issue #550.
The Problem
The original implementation used a single environment variable,
ONEDRIVE_CLIENT_ID, for both "Work/School" and "Personal" OneDrive authentication flows. This is fundamentally incompatible with Microsoft's identity platform, where business and consumer applications must be registered separately.This led to a critical bug: if an administrator configured
ONEDRIVE_CLIENT_IDfor a business tenant (the primary use case), the "Personal OneDrive" feature would inevitably fail with anunauthorized_clienterror because the business-only Client ID was being presented to the consumer login service (login.live.com).The Solution
This PR introduces a complete technical fix by separating the configurations for the two account types:
Backend Changes (
config.py,main.py):ONEDRIVE_PERSONAL_CLIENT_ID, has been introduced to hold the Client ID for a separate, consumer-facing Azure App Registration./api/configendpoint has been updated to expose this newpersonal_client_idto the frontend, ensuring the client-side has all necessary credentials.Frontend Changes (
onedrive-file-picker.ts):getMsalInstancefunction now dynamically selects the correct Client ID based on theauthorityType(personalororganizations).personalClientIdis used.clientIdis used.Impact
Documentation
To support this change and address all other points from Docs issue 550, the documentation has been comprehensively updated in a parallel effort:
ONEDRIVE_PERSONAL_CLIENT_IDvariable and clarify the specific roles of each configuration setting.This PR, combined with the updated documentation, provides a complete and robust solution for the OneDrive integration.
Updated env var config (dev) based on THIS PR's CHANGES: https://github.com/open-webui/docs/blob/main/docs/getting-started/env-configuration.md#OneDrive
NEW OneDrive setup guide (dev) based on THIS PR's CHANGES: https://github.com/open-webui/docs/blob/dev/docs/tutorials/integrations/onedrive-sharepoint.mdx
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.