mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-23 21:45:39 +00:00
138 lines
6.5 KiB
Markdown
138 lines
6.5 KiB
Markdown
|
|
---
|
||
|
|
sidebar_position: 3
|
||
|
|
slug: /add_google_drive
|
||
|
|
---
|
||
|
|
|
||
|
|
# Add Google Drive
|
||
|
|
|
||
|
|
## 1. Create a Google Cloud Project
|
||
|
|
|
||
|
|
You can either create a dedicated project for RAGFlow or use an existing
|
||
|
|
Google Cloud external project.
|
||
|
|
|
||
|
|
**Steps:**
|
||
|
|
1. Open the project creation page\
|
||
|
|
`https://console.cloud.google.com/projectcreate`
|
||
|
|

|
||
|
|
2. Select **External** as the Audience
|
||
|
|

|
||
|
|
3. Click **Create**
|
||
|
|

|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
## 2. Configure OAuth Consent Screen
|
||
|
|
|
||
|
|
1. Go to **APIs & Services → OAuth consent screen**
|
||
|
|
2. Ensure **User Type = External**
|
||
|
|

|
||
|
|
3. Add your test users under **Test Users** by entering email addresses
|
||
|
|

|
||
|
|

|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
## 3. Create OAuth Client Credentials
|
||
|
|
|
||
|
|
1. Navigate to:\
|
||
|
|
`https://console.cloud.google.com/auth/clients`
|
||
|
|
2. Create a **Web Application**
|
||
|
|

|
||
|
|
3. Enter a name for the client
|
||
|
|
4. Add the following **Authorized Redirect URIs**:
|
||
|
|
|
||
|
|
```
|
||
|
|
http://localhost:9380/v1/connector/google-drive/oauth/web/callback
|
||
|
|
```
|
||
|
|
|
||
|
|
### If using Docker deployment:
|
||
|
|
|
||
|
|
**Authorized JavaScript origin:**
|
||
|
|
```
|
||
|
|
http://localhost:80
|
||
|
|
```
|
||
|
|
|
||
|
|

|
||
|
|
### If running from source:
|
||
|
|
**Authorized JavaScript origin:**
|
||
|
|
```
|
||
|
|
http://localhost:9222
|
||
|
|
```
|
||
|
|
|
||
|
|

|
||
|
|
5. After saving, click **Download JSON**. This file will later be
|
||
|
|
uploaded into RAGFlow.
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
## 4. Add Scopes
|
||
|
|
|
||
|
|
1. Open **Data Access → Add or remove scopes**
|
||
|
|
|
||
|
|
2. Paste and add the following entries:
|
||
|
|
|
||
|
|
```
|
||
|
|
https://www.googleapis.com/auth/drive.readonly
|
||
|
|
https://www.googleapis.com/auth/drive.metadata.readonly
|
||
|
|
https://www.googleapis.com/auth/admin.directory.group.readonly
|
||
|
|
https://www.googleapis.com/auth/admin.directory.user.readonly
|
||
|
|
```
|
||
|
|
|
||
|
|

|
||
|
|
3. Update and Save changes
|
||
|
|
|
||
|
|

|
||
|
|

|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
## 5. Enable Required APIs
|
||
|
|
Navigate to the Google API Library:\
|
||
|
|
`https://console.cloud.google.com/apis/library`
|
||
|
|

|
||
|
|
|
||
|
|
Enable the following APIs:
|
||
|
|
|
||
|
|
- Google Drive API
|
||
|
|
- Admin SDK API
|
||
|
|
- Google Sheets API
|
||
|
|
- Google Docs API
|
||
|
|
|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|

|
||
|
|
|
||
|
|
------------------------------------------------------------------------
|
||
|
|
|
||
|
|
## 6. Add Google Drive As a Data Source in RAGFlow
|
||
|
|
|
||
|
|
1. Go to **Data Sources** inside RAGFlow
|
||
|
|
2. Select **Google Drive**
|
||
|
|
3. Upload the previously downloaded JSON credentials
|
||
|
|

|
||
|
|
4. Enter the shared Google Drive folder link (https://drive.google.com/drive), such as:
|
||
|
|

|
||
|
|
|
||
|
|
5. Click **Authorize with Google**
|
||
|
|
A browser window will appear.
|
||
|
|

|
||
|
|
Click: - **Continue** - **Select All → Continue** - Authorization should
|
||
|
|
succeed - Select **OK** to add the data source
|
||
|
|

|
||
|
|

|
||
|
|

|
||
|
|

|
||
|
|
|
||
|
|
|