mirror of
https://github.com/open-webui/open-webui
synced 2025-01-01 08:42:14 +00:00
fix: Resolve Google Drive Picker 404 error and improve configuration
This commit is contained in:
parent
29efee8ede
commit
b9499b4392
@ -1,7 +1,7 @@
|
|||||||
// Google Drive Picker API configuration
|
// Google Drive Picker API configuration
|
||||||
const API_KEY = import.meta.env.VITE_GOOGLE_API_KEY;
|
const API_KEY = import.meta.env.VITE_GOOGLE_API_KEY;
|
||||||
const CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
|
const CLIENT_ID = import.meta.env.VITE_GOOGLE_CLIENT_ID;
|
||||||
const SCOPE = ['https://www.googleapis.com/auth/drive.readonly'];
|
const SCOPE = ['https://www.googleapis.com/auth/drive.readonly', 'https://www.googleapis.com/auth/drive.file'];
|
||||||
|
|
||||||
// Validate required credentials
|
// Validate required credentials
|
||||||
const validateCredentials = () => {
|
const validateCredentials = () => {
|
||||||
@ -99,11 +99,14 @@ export const createPicker = () => {
|
|||||||
console.log('Auth token obtained successfully');
|
console.log('Auth token obtained successfully');
|
||||||
|
|
||||||
const picker = new google.picker.PickerBuilder()
|
const picker = new google.picker.PickerBuilder()
|
||||||
.addView(google.picker.ViewId.DOCS)
|
.enableFeature(google.picker.Feature.NAV_HIDDEN)
|
||||||
.addView(google.picker.ViewId.FOLDERS)
|
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
|
||||||
|
.addView(new google.picker.DocsView()
|
||||||
|
.setIncludeFolders(true)
|
||||||
|
.setSelectFolderEnabled(true))
|
||||||
.setOAuthToken(token)
|
.setOAuthToken(token)
|
||||||
.setDeveloperKey(API_KEY)
|
.setDeveloperKey(API_KEY)
|
||||||
.setAppId(CLIENT_ID.split('-')[0]) // Extract app ID from client ID
|
// Remove app ID setting as it's not needed and can cause 404 errors
|
||||||
.setCallback((data: any) => {
|
.setCallback((data: any) => {
|
||||||
console.log('Picker callback received:', data);
|
console.log('Picker callback received:', data);
|
||||||
if (data[google.picker.Response.ACTION] === google.picker.Action.PICKED) {
|
if (data[google.picker.Response.ACTION] === google.picker.Action.PICKED) {
|
||||||
|
Loading…
Reference in New Issue
Block a user