|
| 1 | +--- |
| 2 | +sidebar_position: 3 |
| 3 | +slug: /add_google_drive |
| 4 | +--- |
| 5 | + |
| 6 | +# Add Google Drive |
| 7 | + |
| 8 | +## 1. Create a Google Cloud Project |
| 9 | + |
| 10 | +You can either create a dedicated project for RAGFlow or use an existing |
| 11 | +Google Cloud external project. |
| 12 | + |
| 13 | +**Steps:** |
| 14 | +1. Open the project creation page\ |
| 15 | +`https://console.cloud.google.com/projectcreate` |
| 16 | + |
| 17 | +2. Select **External** as the Audience |
| 18 | + |
| 19 | +3. Click **Create** |
| 20 | + |
| 21 | + |
| 22 | +------------------------------------------------------------------------ |
| 23 | + |
| 24 | +## 2. Configure OAuth Consent Screen |
| 25 | + |
| 26 | +1. Go to **APIs & Services → OAuth consent screen** |
| 27 | +2. Ensure **User Type = External** |
| 28 | + |
| 29 | +3. Add your test users under **Test Users** by entering email addresses |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +------------------------------------------------------------------------ |
| 34 | + |
| 35 | +## 3. Create OAuth Client Credentials |
| 36 | + |
| 37 | +1. Navigate to:\ |
| 38 | + `https://console.cloud.google.com/auth/clients` |
| 39 | +2. Create a **Web Application** |
| 40 | + |
| 41 | +3. Enter a name for the client |
| 42 | +4. Add the following **Authorized Redirect URIs**: |
| 43 | + |
| 44 | +``` |
| 45 | +http://localhost:9380/v1/connector/google-drive/oauth/web/callback |
| 46 | +``` |
| 47 | + |
| 48 | +### If using Docker deployment: |
| 49 | + |
| 50 | +**Authorized JavaScript origin:** |
| 51 | +``` |
| 52 | +http://localhost:80 |
| 53 | +``` |
| 54 | + |
| 55 | + |
| 56 | +### If running from source: |
| 57 | +**Authorized JavaScript origin:** |
| 58 | +``` |
| 59 | +http://localhost:9222 |
| 60 | +``` |
| 61 | + |
| 62 | + |
| 63 | +5. After saving, click **Download JSON**. This file will later be |
| 64 | + uploaded into RAGFlow. |
| 65 | + |
| 66 | + |
| 67 | + |
| 68 | +------------------------------------------------------------------------ |
| 69 | + |
| 70 | +## 4. Add Scopes |
| 71 | + |
| 72 | +1. Open **Data Access → Add or remove scopes** |
| 73 | + |
| 74 | +2. Paste and add the following entries: |
| 75 | + |
| 76 | +``` |
| 77 | +https://www.googleapis.com/auth/drive.readonly |
| 78 | +https://www.googleapis.com/auth/drive.metadata.readonly |
| 79 | +https://www.googleapis.com/auth/admin.directory.group.readonly |
| 80 | +https://www.googleapis.com/auth/admin.directory.user.readonly |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | +3. Update and Save changes |
| 85 | + |
| 86 | + |
| 87 | + |
| 88 | + |
| 89 | +------------------------------------------------------------------------ |
| 90 | + |
| 91 | +## 5. Enable Required APIs |
| 92 | +Navigate to the Google API Library:\ |
| 93 | +`https://console.cloud.google.com/apis/library` |
| 94 | + |
| 95 | + |
| 96 | +Enable the following APIs: |
| 97 | + |
| 98 | +- Google Drive API |
| 99 | +- Admin SDK API |
| 100 | +- Google Sheets API |
| 101 | +- Google Docs API |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | + |
| 106 | + |
| 107 | + |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | +------------------------------------------------------------------------ |
| 117 | + |
| 118 | +## 6. Add Google Drive As a Data Source in RAGFlow |
| 119 | + |
| 120 | +1. Go to **Data Sources** inside RAGFlow |
| 121 | +2. Select **Google Drive** |
| 122 | +3. Upload the previously downloaded JSON credentials |
| 123 | + |
| 124 | +4. Enter the shared Google Drive folder link (https://drive.google.com/drive), such as: |
| 125 | + |
| 126 | + |
| 127 | +5. Click **Authorize with Google** |
| 128 | +A browser window will appear. |
| 129 | + |
| 130 | +Click: - **Continue** - **Select All → Continue** - Authorization should |
| 131 | +succeed - Select **OK** to add the data source |
| 132 | + |
| 133 | + |
| 134 | + |
| 135 | + |
| 136 | + |
| 137 | + |
0 commit comments