> ## 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 Drive OAuth App

> Complete guide to creating and configuring a Google Drive 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.

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step1_box.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=185bdc6ec29e60d22071ab7d2a3c9fa0" alt="Google Cloud project dropdown" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step1_box.png" />

2. Click **New Project**.

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step2_new_project.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=bece9665560ec1c901875dcd3a249ce9" alt="Google Cloud new project button" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step2_new_project.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step3_create.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=c798c025882abfa597a2b70512efb8e7" alt="Google Cloud create project form" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step3_create.png" />

4. Select your newly created project.

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step4_select_project.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=d09fbdbf611224f29f93553e6f2df006" alt="Google Cloud select project" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step4_select_project.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step5_apis_and_services.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=0c7cc69914162d1471764aecc7ed893b" alt="Google Cloud APIs & Services menu" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step5_apis_and_services.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step6_enable_api_services.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=114e6f58e68162e19603c646168cf4e2" alt="Enable APIs and Services button" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step6_enable_api_services.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step7_select_drive.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=cd72fd04ce638ade00072ad632dfa338" alt="Search Google Drive API" width="1300" height="656" data-path="images/knowledge-base/google_drive_oauth_app/step7_select_drive.png" />

8. Click **Enable**.

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step8_enable.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=af3835c7fbe5b5ee921b97635f0dd80f" alt="Enable Google Drive API" width="1300" height="656" data-path="images/knowledge-base/google_drive_oauth_app/step8_enable.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step9_oauth_screen.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=e8365600dbc7b4317317d5e863376ad8" alt="OAuth consent screen menu" width="1300" height="656" data-path="images/knowledge-base/google_drive_oauth_app/step9_oauth_screen.png" />

10. Enter the required information and save.

<img src="https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_drive_oauth_app/step10_info.png?fit=max&auto=format&n=b0PbegeaiTqWkRoA&q=85&s=76910e706f79059f1befe7e50b365adc" alt="OAuth consent screen form" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step10_info.png" />

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

<img src="https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_drive_oauth_app/step11_CreateCredentials.png?fit=max&auto=format&n=b0PbegeaiTqWkRoA&q=85&s=8c773829c75be6797064d98c9a460140" alt="Create credentials button" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step11_CreateCredentials.png" />

12. Select **OAuth Client ID**.

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step12_OAuthClientID.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=487e98dd58fc3aca22a6edc6fa9bea50" alt="OAuth Client ID selection" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step12_OAuthClientID.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step13_WebApplication.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=96f43aae22afcbc5031fd992c20a911f" alt="Web application OAuth settings" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step13_WebApplication.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step14_redirect_uri.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=07de7967e1ccc97aa660b4eb9b905805" alt="Add redirect URIs" width="1300" height="656" data-path="images/knowledge-base/google_drive_oauth_app/step14_redirect_uri.png" />

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

<img src="https://mintcdn.com/klavisai/WUyJFoTOOKq1g0EB/images/knowledge-base/google_drive_oauth_app/step15_credentials.png?fit=max&auto=format&n=WUyJFoTOOKq1g0EB&q=85&s=e6defcd178d436b0ff485f90bb304aa4" alt="OAuth credentials screen" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/step15_credentials.png" />

## Step 2: Request Scopes

<Note>
  Klavis Google Drive MCP Server uses the following OAuth scopes:
  `https://www.googleapis.com/auth/drive`
</Note>

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

<img src="https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_drive_oauth_app/scope1_oauth.png?fit=max&auto=format&n=b0PbegeaiTqWkRoA&q=85&s=9f6b678bdb35ff89670414881e37f345" alt="OAuth consent screen" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/scope1_oauth.png" />

2. Click **Data Access**.

<img src="https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_drive_oauth_app/scope2_data_access.png?fit=max&auto=format&n=b0PbegeaiTqWkRoA&q=85&s=6d026c7c7a20dbc93526e98cf3c7d927" alt="Data access settings" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/scope2_data_access.png" />

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

<img src="https://mintcdn.com/klavisai/b0PbegeaiTqWkRoA/images/knowledge-base/google_drive_oauth_app/scope3_add_scopes.png?fit=max&auto=format&n=b0PbegeaiTqWkRoA&q=85&s=5ec7d698d75e07e16210340afaa930a2" alt="Add or remove scopes" width="1298" height="652" data-path="images/knowledge-base/google_drive_oauth_app/scope3_add_scopes.png" />

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

<Check>
  You have successfully created a Google Drive OAuth application! You now have your Client ID and Client Secret ready for integration with Klavis AI.
</Check>

## (Optional) Step 3: White Labeling

<Note>
  White labeling allows you to customize the OAuth experience with your own branding instead of Klavis AI's.
</Note>

If you want to use your own Google Drive 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 Drive **Client ID** and **Client Secret** from Step 1.
3. **Set Redirect URI**: Use `https://api.klavis.ai/oauth/gdrive/callback` or your custom callback URL.
4. **Initiate OAuth**: Use your client ID when starting the OAuth flow:

   <CodeGroup>
     ```javascript without SDK theme={null}
     // Example: Initiating Google Drive OAuth with white-label
     const authUrl = `https://api.klavis.ai/oauth/gdrive/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 Drive OAuth with white-label
     const oauthUrl = await klavis.mcpServer.getOAuthUrl({
       serverName: Klavis.McpServerName.Gdrive,
       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 Drive OAuth with white-label
     oauth_url = klavis.mcp_server.get_oauth_url(
         server_name=McpServerName.GDRIVE,
         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)
     ```
   </CodeGroup>

<Tip>
  For detailed white labeling implementation and code examples, see our [OAuth & White Labeling guide](/auth/white-label).
</Tip>

## Resources

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