mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 23:21:44 -05:00
[GH-ISSUE #13537] issue: OneDrive file picker (only for organizations) throws an error #55609
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?
Originally created by @davejohnb on GitHub (May 5, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/13537
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.6.6
Ollama Version (if applicable)
No response
Operating System
MacOS 15.4.1
Browser (if applicable)
Chrome 136.0.7103.48
Confirmation
README.md.Expected Behavior
Actual Behavior
Unexpected token '<', "<!doctype “… is not valid JSONSteps to Reproduce
Set up the app to use an organizational OneDrive account (not a personal one).
Open the file picker in the app.
The picker popup appears but shows an error page instead of your files.
Check the browser console—you’ll see the JSON parse error about “Unexpected token ‘<’.”
Logs & Screenshots
Additional Information
@hurxxxx As you developed this part of the application, can you reproduce my error? Thanks for your help.
Just FYI: A suggestion of GPT was to simply remove the if (…organizations)… branch in getPickerParams()
@hurxxxx commented on GitHub (May 6, 2025):
I'll check it out soon.
@hurxxxx commented on GitHub (May 6, 2025):
I attempted to reproduce the issue in my environment, but was unable to observe the same behavior. I’ve reviewed the solution suggested by GPT, but it doesn’t appear to be relevant to this particular issue.
To help diagnose the problem further, could you please provide the full error stack trace from the browser console, as well as the request/response details from the Network tab at the time the issue occurs?
In addition, please double-check that the Permissions section described in the following documentation is correctly configured:
https://learn.microsoft.com/en-us/onedrive/developer/controls/file-pickers/?view=odsp-graph-online
@NovaCarlili commented on GitHub (May 6, 2025):
I'm experiencing a similar issue after updating to v0.6.6.
In a new chat window, clicking on the + sign and selecting Microsoft OneDrive -> Microsoft OneDrive (work/school),
nothing seems to happen on the web page, but when inspecting the browser's console I get the following:
I have ENABLE_ONEDRIVE_INTEGRATION set to True and ONEDRIVE_SHAREPOINT_URL configured to one of our Sharepoint sites in my environment variables.
I might be missing something here...
@davejohnb commented on GitHub (May 6, 2025):
@hurxxxx Thanks for investigating. I had already added the following permissions:
This is the entire error stack trace in the console at the time after choosing a file, then trying to add it to the chat:
And this is the activity in the network tab (for the time of opening the picker and trying to load a single file):
and
Is there any "how-to" you could share for this feature, since it’s not yet documented? Others might run into the same issue.
I’d be happy to check if it works from a configuration standpoint and then suggest or contribute it for the official OWUI documentation.
@davejohnb commented on GitHub (May 6, 2025):
@NovaCarlili did you already create and configure an app registration on Azure (including redirect URL, etc)?
@borysow commented on GitHub (May 7, 2025):
We have an on-premises install of sharepoint over here and I’m seeing the same issue. No Azure involved. Is this an issue if missing SSO?
@hurxxxx commented on GitHub (May 7, 2025):
@davejohnb Does it proceed up to the file selection step?
@davejohnb commented on GitHub (May 7, 2025):
@hurxxxx the picker popup shows up with the error message, but I can then navigate to a folder (left sidebar). After selecting a file and pressing the "Select" button, the spinner shows up on the button, the popup closes but the file is not getting loaded into the chat.
@NovaCarlili commented on GitHub (May 7, 2025):
No I didn't, I must have missed that step. Thanks for the hint!
I admit I've been trying to integrate OneDrive a bit blindly, since I couldn't find clear documentation on this. But it's entirely possible that it exists and I simply missed it somehow. Do you know if there is some documentation about such integrations on Open WebUI's website? Because I couldn't find any, other than the Environment Variables section...
Again, thanks a lot!
@davejohnb commented on GitHub (May 7, 2025):
@NovaCarlili Curious if—once you created the app registration in Azure—you get anywhere! Let me know.
And afaik there is no documentation for the One Drive integration. I reverse-engineered as much as I could from the code.
But I'm happy to contribute to the documentation once we get it running and understand where the (config) problem lies.
@NovaCarlili commented on GitHub (May 7, 2025):
@davejohnb I did register an Azure app in Delegated mode and gave it the "Files.Read.All" permission. I couldn't find any clear answer on what the redirect URL should be so I entered it as http://localhost:8080/auth/onedrive/callback (which may very well be wrong).
I also passed my client ID to the ONEDRIVE_CLIENT_ID env variable.
I still get the same visual behavior in which nothing happens on the web page, but the browser console now shows a different error:
May I ask how you managed to get further than that? I couldn't find any other env variables relevant to OneDrive in the source code, other than ENABLE_ONEDRIVE_INTEGRATION, ONEDRIVE_SHAREPOINT_URL and ONEDRIVE_CLIENT_ID.
The GoogleDrive env variables include one for an API key, but OneDrive doesn't seem to have one.
Thank a lot!
@davejohnb commented on GitHub (May 7, 2025):
@NovaCarlili I added a screenshot on top about the permissions. And as far as I got you need to create an SPA and the redirect URL will be the one where your Open WebUI instance runs on.
You just need to add the ONEDRIVE_SHAREPOINT_URL (the one that you see in the browser when you open your Sharepoint) and ONEDRIVE_CLIENT_ID (from your newly created app on Azure app registrations).
@NovaCarlili commented on GitHub (May 7, 2025):
@davejohnb Thanks for the clarification!
I just added the permissions from your screenshot to my Azure app (and granted admin consent). I also changed my ONEDRIVE_SHAREPOINT_URL variable to point to our generic Sharepoint URL (https://myorg.sharepoint.com) instead of the site specific URL I had before (https://myorg.sharepoint.com/sites/mysite).
I am still getting the same BrowserAuthError as in my last reply.
I tried creating an SPA, but my Open WebUI instance lives in a docker container (on a headless server) at http://192.168.1.22:3000, and Azure will not let me enter a URL that is not HTTPS.
I am still in the exploration phase and I haven't generated a certificate for my server yet. Do you think it is absolutely required? Or is there a way to work around that?
@davejohnb commented on GitHub (May 7, 2025):
@NovaCarlili Not sure but just got this file picker showing up after creating the SPA with the correct redirect URL, so it might be necessary to generate a certificate.
I have our OWUI instance running as docker in Azure and there, the URL + certificate gets created automatically, so I didn't have to worry about that..
@NovaCarlili commented on GitHub (May 7, 2025):
@davejohnb gotcha, I guess I'll try that then! Thanks a lot for your insight.
Just to make sure, would this be the correct redirect url format (once my certificate is issued)?
https://192.168.1.22:3000/auth/onedrive/callback
@davejohnb commented on GitHub (May 7, 2025):
@NovaCarlili Sure thing. For now I used simply my URL (without port and /auth/onedrive/callback). I just tried adding it as I was curious if that might solve my problem, but then I get an error and the file picker doesn't open anymore..
@NovaCarlili commented on GitHub (May 7, 2025):
Interesting... I'll keep digging then. Thanks a lot! :)
@mjtrangoni commented on GitHub (May 8, 2025):
The same here, fighting a little bit with the RedirectURI for the Single-Page-Application. Now it opens a new window for Sharepoint, but there are a lot of errors in the console, see,
Once I refresh the page, I can see something. Once I select the file, and click there, nothing happens.
mmm and about the callback URI, it seems at least for me, it is not static.
@hurxxxx commented on GitHub (May 8, 2025):
I created a new organization to test and confirm the setup. Below are the steps I followed to successfully complete the configuration. Please refer to this guide:
Prerequisites
localhost..env Environment Variables
Azure Portal Configuration
Go to Microsoft Entra ID → View
Open App registrations
Accounts in any organizational directory (Any Microsoft Entra ID tenant - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)→ Type:
Single-page application (SPA)→ Value: your domain (e.g.,
https://yourdomain.com)After registration, go into your app:
localhostand any development domains as Single-page application redirect URIs@davejohnb commented on GitHub (May 8, 2025):
@hurxxxx Absolutely amazing, thanks for the guide. I can already see I was missing a few steps at the end. Will test tonight and provide feedback. Thanks for your support ♡
@hurxxxx commented on GitHub (May 9, 2025):
@davejohnb #13703
There have been changes related to single-tenant organization users in the development branch. Please take note.
@davejohnb commented on GitHub (May 9, 2025):
@hurxxxx Just a quick feedback (cc @NovaCarlili ) I got it running with your instructions. The missing part for me was some app permissions. After setting them I had to wait / clear caches to make it run. Thanks a lot for your help.
Does it make sense to propose changes to the documentation on that end or no need?
@NovaCarlili commented on GitHub (May 9, 2025):
@davejohnb Thanks for the feedback! I haven't gotten around to work out my https issue yet, but I feel like this thread has a lot of relevant info to get the OneDrive file picker up and running once that's done.
@hurxxxx commented on GitHub (May 9, 2025):
@davejohnb Updates and PRs to the documentation are always welcome! Thanks for bringing it up.