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

# OAuth Setup

OAuth Setup for Google Drive Connector
This section walks through setting up the Google Drive connector using an OAuth-enabled Google App. Anyone can do this (even without a paid Google Workspace)!

If you’re an organization with a Google Workspace, and you’d rather use a Service Account to access Google Drive, checkout the section [here](#).

## Authorization

### Create a Google Cloud Project

* Visit the Google Cloud Console to create a new project: [Create Project](https://console.cloud.google.com/projectcreate)

### Enable the Google Drive API

* On the left panel, open **APIs & services**.
* Go to **Enabled APIs and services**.
* Click **+ ENABLE APIS AND SERVICES** at the top.
* Search for **Google Drive API** and click **ENABLE**.
* Alternatively, visit this link, select your project, and enable the Google Drive API.

### Enable the Admin SDK API

* Click on **+ ENABLE APIS AND SERVICES** again.
* Search for **Admin SDK API** and click **ENABLE**.
* Alternatively, visit this link, select your project, and enable the Admin SDK API.

### Enable the Google Sheets API

* Click on **+ ENABLE APIS AND SERVICES** again.
* Search for **Google Sheets API** and click **ENABLE**.
* Alternatively, visit this link, select your project, and enable the Google Sheets API.

### Enable the Google Docs API

* Click on **+ ENABLE APIS AND SERVICES** again.
* Search for **Google Docs API** and click **ENABLE**.
* Alternatively, visit this link, select your project, and enable the Google Docs API.

### Set up the OAuth consent screen

* Under **APIs & services**, select the **OAuth consent screen** tab.
* If you don’t have a Google Organization, select **External** for **User Type**.
* Call the app **Hymalaia** (or whatever you prefer).
* For the required emails, use any email of your choice or **[support@hymalaia.com](mailto:support@hymalaia.com)** if you wish for the Hymalaia team to help handle issues.
* Click **SAVE AND CONTINUE**.

### Set up Scopes

* Add the scope `.../auth/drive.readonly` for Google Drive API.
* Add the scope `.../auth/drive.metadata.readonly` for Google Drive API.
* Add the scope `.../auth/admin.directory.user.readonly` for Admin SDK API.
* Add the scope `.../auth/admin.directory.group.readonly` for Admin SDK API.

**Important:** If you plan on using permission syncing for this connector, the account performing the OAuth flow must have an Admin role in the Google Workspace that has access to the “Groups > Read” privilege. This can be set by an admin in the admin panel of the Google Workspace under **Account > Admin roles**.

### Set up Test users

This step is only applicable for users without a Google Organization.

* Typically for a company, Hymalaia would be set up as an internal app, so this step would not apply.
* Add at least one test user email. Only the email accounts added here will be allowed to run the OAuth flow to index new documents.
* Click **SAVE AND CONTINUE**, review the changes, and click **BACK TO DASHBOARD**.

### Create Credentials

* Go to the **Credentials** tab and select **+ CREATE CREDENTIALS** -> **OAuth client ID**.
* Choose **Web application** and give it a name like **HymalaiaConnector**.
* Add an **Authorized JavaScript origin** for `http://localhost:3000` (or `https://<INTERNAL_DEPLOYMENT_URL>` if you have set up Hymalaia for production use).
* Add an **Authorized redirect URI** for `http://localhost:3000/admin/connectors/google-drive/auth/callback` (or `https://<INTERNAL_DEPLOYMENT_URL>/admin/connectors/google-drive/auth/callback` if you have set up Hymalaia for production use).
* Click **Create** and on the right-hand side, next to **Client secret**, there is an option to download the credentials as a **JSON**. Download the JSON for use in the next step.
