> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tryassist.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Drive Service Account

This guide walks you through connecting Google Drive using a Service Account. For more details on Service Accounts, refer [**here**](https://cloud.google.com/iam/docs/service-account-overview). Note that a Google Workspace account is required for this method

If you'd prefer to use an individual account with OAuth instead, refer to the OAuth setup section.

## Authorization

1. **Create a Google Cloud Project**
   Visit [https://console.cloud.google.com/projectcreate](https://console.cloud.google.com/projectcreate) and set up a new project.
2. **Enable required APIs**
   Enable the **Google Drive API**, the **Admin SDK API**, the **Google Docs API**, and the **Google Sheets API**
   * On the left panel, open **APIs & services**
   * Go to **Enabled APIs and services**
   * On the top click **+ENABLE APIS AND SERVICES**
   * Search for **Google Drive API** and click **ENABLE**
   * Alternatively visit this [**link**](https://console.cloud.google.com/flows/enableapi?apiid=drive.googleapis.com), select your project and enable the **Google Drive API**
   * Search and enable: **Admin SDK API**, **Google Sheets API**, **Google Docs API**
3. **Create Service Account**
   * Go to the [**Service Account management page**](https://console.cloud.google.com/iam-admin/serviceaccounts) in Google Cloud.
   * Click `Create Service Account` button and fill out the fields in step 1. You can ignore steps 2 and 3.
   * Go to the `Keys` section, and click `Add Key`. Download this key, you will need to upload it to ASSIST AI later.

Note for Google Organizations created after April 2024:

* To give the service account the proper permissions you will have to navigate to this [**link**](https://console.cloud.google.com/iam-admin/orgpolicies/iam-disableServiceAccountKeyCreation)
* Then select `Manage`, select `Override parent's policy` and then select `Not enforced` under `Rules`.
* Finally, select `SET POLICY`

4. **Grant domain-wide delegation**
   Give this **Service Account** read-only access to Google Drive
   * Copy the `Unique ID` of the Service Account
   * Go to the [**Domain-wide Delegation page**](https://admin.google.com/ac/owl/domainwidedelegation) in the Google Admin Console.
   * Click `Add new`, fill in the client ID with the `Unique ID` of the Service account
   * Copy this comma separated list of scopes and paste it into field `OAuth scopes`: `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`

## Indexing

Navigate to the Admin Panel and select the **Google Drive connector**. Create a new credential and upload the key file downloaded in Step 3. For the **Primary Admin Email**, use the email of a user who meets the following requirements:

* Has access to **Drive and Docs** in Google Workspace
* Holds the following admin privileges:
  * Admin Console Privileges → Services → Drive and Docs → Settings
  * Admin API Privileges → Users → Read
  * Admin API Privileges → Groups → Read
  * Admin API Privileges → Organization Units → Read

This can be an existing admin account or a dedicated account created specifically for ASSIST AI (e.g. `assistai-robot@your-domain.com`). Note that this should **not** be the service account email itself. These permissions can be configured by an admin under **Account → Admin Roles** in the Google Workspace Admin Panel.

Once done, click **Create Credential** and close the dialog. Then click **Continue** to finish configuring the connector.
