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

# Setting Up Google Docs OAuth App

> Complete guide to creating and configuring a Google Docs OAuth application

## Prerequisites

* Google account

## Step 1: Create a Project

1. Visit [https://console.cloud.google.com/home/dashboard](https://console.cloud.google.com/home/dashboard) and select the project dropdown at the top.

![Google Cloud project dropdown](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step1_box.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=b3c41b7f93be30f310b48d0e0ee6155f)

2. Click **New Project**.

![Google Cloud new project button](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step2_new_project.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=d0a9bb9fd79ef3bf6b78c2d75cc22d73)

3. Enter the project details and click **Create**.

![Google Cloud create project form](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step3_create.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=4d6285f1ae4ad1967dcc4c8b9e5186bf)

4. Select your newly created project.

![Google Cloud select project](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step4_select_project.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=3f07e6e5367722135602e25beac5e955)

5. Go to **APIs & Services**.

![Google Cloud APIs & Services menu](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step5_apis_and_services.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=b97748051228958a5630be05f5997509)

6. Click **Enable APIs and Services**.

![Enable APIs and Services button](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step6_enable_api_services.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=ca747e346e507585a9bc4bf146b7dffc)

7. Search for and select **Google Docs API**.

![Search Google Docs API](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step7_select_docs.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=50987e53d225e41167964dd515c31c20)

8. Click **Enable**.

![Enable Google Docs API](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step8_enable.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=14f539b668a99e3813129f0c63222ce0)

9. Go back to **APIs & Services** and select **OAuth consent screen**.

![OAuth consent screen menu](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step9_oauth_screen.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=36190339990ab4d7979084a4c685a30c)

10. Enter the required information and save.

![OAuth consent screen form](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step10_info.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=baa73e8ff1148a1a0d09389c1b7816ff)

11. Go to **Credentials** in APIs & Services and click **Create Credentials**.

![Create credentials button](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step11_CreateCredentials.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=bdda5c705745aea8b8943d27229451a1)

12. Select **OAuth Client ID**.

![OAuth Client ID selection](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step12_OAuthClientID.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=fbf3edfb2a4a25693cc3e630e3d7e5e2)

13. Choose **Web Application** and enter the required details.

![Web application OAuth settings](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step13_WebApplication.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=4a6872f0ed1106df067c435d8c661028)

14. Add redirect URLs:
    `https://api.klavis.ai/oauth/gdocs/callback`
    Then click **Create**.

![Add redirect URIs](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step14_redirect_uri.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=9e01d4f812801fcfc2010c3679ce9076)

15. Your **Client ID** and **Client Secret** will be displayed.

![OAuth credentials screen](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/step15_credentials.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=509fe61a148050b2c94d8d0d9d5b69c5)

## Step 2: Request Scopes

> [!NOTE]
>
> Klavis Google Docs MCP Server uses the following OAuth scopes:
> `https://www.googleapis.com/auth/drive`

1. Go to **OAuth consent screen**.

![OAuth consent screen](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/scope1_oauth.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=c78ba252ab37f9baae8922b23c97e9ac)

2. Click **Data Access**.

![Data access settings](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/scope2_data_access.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=1a27c040c198beff686e47c488214e01)

3. Click **Add or Remove Scopes**.

![Add or remove scopes](https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_docs_oauth_app/scope3_add_scopes.png?fit=max\&auto=format\&n=b0PbegeaiTqWkRoA\&q=85\&s=872e8cc66cf1c3a349bed6cd6f74621f)

4. Enter the needed scopes and click **Update**.

> [!TIP]
>
> You have successfully created a Google Docs OAuth application! You now have your Client ID and Client Secret ready for integration with Klavis AI.

## (Optional) Step 3: White Labeling

> [!NOTE]
>
> White labeling allows you to customize the OAuth experience with your own branding instead of Klavis AI's.

If you want to use your own Google Docs OAuth application with custom branding:

1. **Configure White Labeling**: Go to [https://www.klavis.ai/home/white-label](https://www.klavis.ai/home/white-label)
2. **Add Your Credentials**: Enter your Google Docs **Client ID** and **Client Secret** from Step 1.
3. **Set Redirect URI**: Use `https://api.klavis.ai/oauth/gdocs/callback` or your custom callback URL.
4. **Initiate OAuth**: Use your client ID when starting the OAuth flow:

   ```javascript without SDK theme={null}
   // Example: Initiating Google Docs OAuth with white-label
   const authUrl = `https://api.klavis.ai/oauth/gdocs/authorize?instance_id=${instanceId}&client_id=${yourClientId}`;
   window.location.href = authUrl;
   ```

   ```typescript TypeScript SDK theme={null}
   import { Klavis } from "@klavis/sdk";

   const klavis = new Klavis({
     apiKey: "YOUR_API_KEY"
   });

   // Example: Initiating Google Docs OAuth with white-label
   const oauthUrl = await klavis.mcpServer.getOAuthUrl({
     serverName: Klavis.McpServerName.Gdocs,
     instanceId: instanceId,
     clientId: yourClientId,
     // redirectUri: YOUR_REDIRECT_URI,
     // scope: "YOUR_SCOPES", 
   });

   window.location.href = oauthUrl;
   ```

   ```python Python SDK theme={null}
   import webbrowser
   from klavis import Klavis
   from klavis.types import McpServerName

   klavis = Klavis(api_key="YOUR_API_KEY")

   # Example: Initiating Google Docs OAuth with white-label
   oauth_url = klavis.mcp_server.get_oauth_url(
       server_name=McpServerName.GDOCS,
       instance_id=instance_id,
       client_id=your_client_id,
       # redirect_uri="YOUR_REDIRECT_URI",
       # scope="YOUR_SCOPES"
   )

   # Open OAuth URL in user's default browser
   webbrowser.open(oauth_url)
   ```

> [!TIP]
>
> For detailed white labeling implementation and code examples, see our [OAuth & White Labeling guide](https://www.klavis.ai/docs/auth/white-label.md).

## Resources

* [Klavis OAuth & White Labeling Guide](https://www.klavis.ai/docs/auth/white-label.md)
* [Klavis White Label Dashboard](https://www.klavis.ai/home/white-label)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.