Skip to main content

Connect Google Drive

The Google connector signs in to one Google account with read-only Drive access, so a Google Drive source can sync that account's folders and files into a Knowledge.

Who can set it up​

  • In Rational AI: a role with Create on the Connectors row to add the connector, Create on the Sources row and Use on the Connectors row to add the source, and Update on the Knowledge row to attach it. Sources needs the Knowledge module in your license. See Manage roles and users.
  • In Google Cloud: someone who can enable APIs and create OAuth clients in a Google Cloud project.
  • In Google Drive: the account that signs in when you authorize the connector. The source sees what that account sees.

What you need​

  • A Google Cloud project that belongs to your Google Workspace organization, so the OAuth consent screen can be Internal.
  • The address you open Rational AI at, for example https://ai.example.com.
  • A Knowledge to receive the files.

The connector asks Google for one scope during sign-in:

PermissionWhy it's needed
https://www.googleapis.com/auth/drive.readonlyLists the folders and files the account can see, downloads them, and reads the Drive changes feed for Automatic syncs. It can't create, change, or delete anything in Drive.

The Google connector only powers Google Drive sources. Its description in the connector gallery also names Gmail and Calendar, but it never asks for access to them. To let an assistant answer email in a Gmail mailbox, see Connect a mailbox.

Set up​

  1. In the Google Cloud console, open your project, go to APIs & Services → Library, and enable the Google Drive API.
  2. Go to Google Auth Platform. If it isn't configured yet, select Get started, enter an app name and a support email, and choose Internal as the Audience.
  3. In Data Access, select Add or remove scopes, add https://www.googleapis.com/auth/drive.readonly, and save.
  4. In Clients, create a client with the application type Web application. In Authorized redirect URIs, add your Rational AI address followed by /api/management/v0/oauth/callback, for example https://ai.example.com/api/management/v0/oauth/callback.
  5. Copy the Client ID and the Client secret.
  6. In Rational AI, go to Settings → Connectors, select Add, select Google, then select Add.
  7. Enter a Name, for example Marketing Drive, and paste the Client ID and Client Secret.
  8. Select Add and authorize and sign in with the Google account whose files you want to sync. Google returns you to Rational AI once you allow access.
  9. Go to Settings → Sources and select Add.
  10. Enter a Name, for example Marketing team Drive. In Type, find Google Drive and select your connector under it.
  11. In the file panel, select the folders and files to sync. Use Filter files and folders... to narrow the tree.
  12. Select Add. Rational AI creates the source and runs its first sync.
  13. Go to Settings → Knowledge, open the Knowledge, select the Sources tab, and pick the source in Add source....
  14. Open the source's menu on that tab and select Process now to process the synced files.

A new source syncs only when you select Sync now. To keep it current, set its sync mode as described in Choose when a source syncs.

What gets synced​

  • The folders and files you selected. A selected folder includes everything inside it, also files added to it later.
  • Google Docs, Sheets, and Slides as .docx, .xlsx, and .pptx files, so the Knowledge can process them like any other document.
  • Changes, according to the source's sync mode. Google Drive sources support Automatic, Periodic, and Manual. With Automatic, Rational AI checks the account's Drive changes feed every two minutes and syncs only when something changed.

The file panel lists the signed-in account's My Drive. Shared drives and files under Shared with me don't appear in it.

Rational AI never writes to Drive. Files deleted from Drive leave the Knowledge too when the source's On delete setting is Cascade delete, the default.

Limits​

  • One connector signs in to one Google account. To sync another account's files, add another connector.
  • The Drive changes feed covers the whole account, not only the source's folders. An edit elsewhere in the account starts a sync that finds nothing new.
  • The connector can't be authorized again once it holds a token. If the account's access is revoked, add a new connector and switch the source to it.

Troubleshooting​

SymptomWhat to check
A broken-link icon (Missing authentication) next to the connectorThe Google sign-in wasn't completed, so the connector holds no token. Open the connector, select Complete authentication in its menu, and sign in.
Google shows redirect_uri_mismatch during sign-inThe OAuth client's Authorized redirect URIs must contain your Rational AI address followed by /api/management/v0/oauth/callback, with the same scheme and host you use in the browser.
Google shows access blocked or app not verifiedThe consent screen's audience is External. Set it to Internal in Google Auth Platform → Audience, or sign in with an account from your Workspace organization.
The file panel shows Connection failedThe connector can't reach Drive. Check that the Google Drive API is enabled in the project and that the sign-in completed.
The folder you want isn't in the file panelIt's in a shared drive or in Shared with me. Only My Drive is listed.
Syncs fail after working for some daysThe account's access was revoked, or the client secret was deleted in Google Cloud. Add a new Google connector, edit the source, select the new connector in Type, and select the folders again.

Next steps​