mirror of
https://github.com/open-webui/open-webui
synced 2025-03-04 03:18:03 +00:00
feat: Add credential validation for Google Drive API initialization
This commit is contained in:
parent
f29dc2f865
commit
a0ba5974f6
@ -3,6 +3,13 @@ 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'];
|
||||||
|
|
||||||
|
// Validate required credentials
|
||||||
|
const validateCredentials = () => {
|
||||||
|
if (!API_KEY || !CLIENT_ID) {
|
||||||
|
throw new Error('Google Drive API credentials not configured. Please set VITE_GOOGLE_API_KEY and VITE_GOOGLE_CLIENT_ID environment variables.');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let pickerApiLoaded = false;
|
let pickerApiLoaded = false;
|
||||||
let oauthToken: string | null = null;
|
let oauthToken: string | null = null;
|
||||||
let initialized = false;
|
let initialized = false;
|
||||||
@ -65,6 +72,7 @@ export const getAuthToken = async () => {
|
|||||||
|
|
||||||
const initialize = async () => {
|
const initialize = async () => {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
|
validateCredentials();
|
||||||
await Promise.all([loadGoogleDriveApi(), loadGoogleAuthApi()]);
|
await Promise.all([loadGoogleDriveApi(), loadGoogleAuthApi()]);
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user