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

# Service Account Setup

This section walks through setting up the Google Drive connector using a Service Account.
More info on Service Accounts can be found [here](https://cloud.google.com/iam/docs/service-account-overview).
A Google Workspace is required.

If you'd rather use an individuals account + OAuth to access Google Drive, checkout the section
[here](/connectors/google_drive/oauth).

### Authorization

1. Create a **Google Cloud Project**
   * [https://console.cloud.google.com/projectcreate](https://console.cloud.google.com/projectcreate)

2. Enable the **Google Drive 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**

![GoogleDriveEnableAPI](https://mintlify.s3-us-west-1.amazonaws.com/edux/images/connectors/google_drive/GoogleDriveEnableAPI.png)

3. Create a **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 to to Danswer
     later.

<iframe width="840" height="473" src="https://www.youtube.com/embed/Z5R9HUCVVAE?si=GZxteF6rmIHa1BOE" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen;" allowfullscreen />

4. 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/u/3/ac/owl/domainwidedelegation) in the Google Admin Console.
   * Click `Add new`, fill in the client ID with the `Unique ID` of the Service Account, and add the `https://www.googleapis.com/auth/drive.readonly`
     and `https://www.googleapis.com/auth/drive.metadata.readonly` scopes.

<iframe width="840" height="473" src="https://www.youtube.com/embed/2LbmV-EcbP0?si=zABgNzEIowdXYEt9" title="YouTube video player" frameBorder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share; fullscreen;" allowfullscreen />

### Indexing

1. Navigate to the Admin Dashboard and select the **Google Drive** Connector.
2. Select the Service Account Key JSON that you downloaded in step (3), then click the **Upload** button to save your credentials into Danswer.
3. Optionally select a user to "impersonate" when fetching files.
   * If a user email is provided, then Danswer will have access to all documents that user has access to.
   * If no user email is provided, then Danswer will have access to all documents that the Service Account you created
     in step (3) has access to. By default, this is no documents. You will have to share the relevant drives / shared drives
     with the Service Account so that it can pull documents.
4. Click the `Connect` button (optionally specifying specific paths that you want to index)! All documents
   accessible by the account specified in the previous step will now be pulled into Danswer every **10** minutes.
