This page describes how to configure OAuth to connect Google Drive to Gemini Enterprise as a data store.
Set up authentication and permissions for Google Drive
To enable Google Drive actions, a Google Cloud administrator must perform the following steps to enable the Google Drive API and set up authentication.
Enable the Google Drive API
In the Google Cloud console, enable the Google Drive API.
Create an OAuth app and add scopes
If you don't have an OAuth app, follow these steps. If you already have an OAuth app, skip to Create OAuth client credentials.
Go to Google Auth Platform > Overview.
Click Get started.
Enter a name for your OAuth app.
In User support email, select a support email address for your application's users to contact with questions about their consent.
Under Audience, select the user type for your app:
- External: Select External if you're creating an app for use outside of your Google Workspace organization. This makes the app publicly available to any user with a Google account.
If you selected External, add test users:
- Click Audience.
- Under Test users, click Add users.
- Enter your email address and any other authorized test users, then click Save.
- Internal: Select Internal if the app is restricted to members of a specific Google Cloud organization, limiting access to Google Workspace organizational members only.
- External: Select External if you're creating an app for use outside of your Google Workspace organization. This makes the app publicly available to any user with a Google account.
If you selected External, add test users:
Click Next.
Under Contact Information, enter an email address where you can be notified about any changes to your project.
Click Next.
Under Finish, review the Google API Services User Data Policy. If you agree, select I agree to the Google API Services: User Data Policy.
Click Continue.
Click Create.
After you create the app, you can update the OAuth Consent Screen settings in Branding and Audience.
Add scopes
To add the minimum required scopes, follow these steps:
- In the Google Cloud console, go to Menu .
- Select Data Access from the navigation menu.
- Click Add or Remove Scopes.
- Under Manually add scopes, paste the following scopes for Google Drive based on your requirements:
| Connection mode | Scope | Purpose |
|---|---|---|
| Federated search | https://www.googleapis.com/auth/drive.readonly |
Minimum permission required to search and retrieve content. Allows the data store to list files and folders, view metadata, list permissions, and download file content. |
| Federated search and Actions | https://www.googleapis.com/auth/drive.readonlyhttps://www.googleapis.com/auth/drive.file |
drive.readonly is required for searching and retrieving content. drive.file is required to upload files, create folders and files. |
5. Click Add to table and then click Update.
6. Click Save.
Create OAuth client credentials
This procedure describes how to create a new OAuth client ID for Google Cloud actions. If you already have an OAuth client ID for Google Cloud actions, you can use that client ID and secret for Google Drive actions instead of creating a new one.
Click Create client.
For Application type, select Web application.
In the Name field, enter a name for the credential.
Skip Authorized JavaScript origins.
In the Authorized redirect URIs section, click Add URI and enter the following URI:
https://vertexaisearch.cloud.google.com/oauth-redirectClick Create. The newly created credential appears under OAuth 2.0 Client IDs. Open the client you just created and copy the following information:
- Client ID
- Client secret