@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 06:00 UTC

next
md 108 lines 8.57 KB
Rendered Raw
1 ## How do I set up custom Google OAuth credentials for Google Docs?
2
3 Use your own Google OAuth app when you want your app's name on Google's consent screen, a dedicated API quota, or scopes that Composio's managed app doesn't cover.
4
5 ### Create the Google OAuth app
6
7 1. Open the [Google Cloud console](https://console.cloud.google.com/) and select the project that will own the OAuth app, or create one.
8
9 ![Google Cloud project picker with the OAuth app's project selected](/images/toolkits/shared/hjaj4jg5CtBRolXXYddY8NDXCes.webp)
10
11 2. Go to **APIs & Services** → **Library**, search for **Google Docs API**, and click **Enable**. The default scopes include Drive access, so enable the **Google Drive API** too if your tools search or manage documents through Drive. If the API page shows **Manage**, the API is already enabled. Enabling an API needs project permissions; ask your project admin if you can't.
12
13 ![Google Docs API page in the Google Cloud API Library with the Enable button](/images/toolkits/googledocs/enable-docs-api.webp)
14
15 3. Go to **Google Auth Platform** → **Branding**. If you see **Get started**, enter the app name, user support email, and developer contact email, then save.
16
17 ![Google Auth Platform Branding page with the app name and user support email fields](/images/toolkits/shared/x4VkWS3iceKKFGyjlFN1THrtTRQ.webp)
18
19 4. Under **Audience**, choose the user type. **Internal** limits sign-in to accounts in your Google Workspace organization. **External** allows any Google account. An External app starts in **Testing**; add every account that will connect under **Test users**.
20
21 ![Google Auth Platform Audience page showing Testing status, the External user type, and Test users](/images/toolkits/shared/Jttbz3Cm6xJFWNlukXLGTxWjf6c.webp)
22
23 5. Under **Data Access**, click **Add or remove scopes** and add the scopes your auth config will request (see **Scopes** below). Paste any scope missing from the list under **Manually add scopes** and click **Add to table**. Click **Update**, then **Save**.
24
25 ![Data Access scope picker with the documents.readonly scope selected](/images/toolkits/googledocs/data-access-scopes.webp)
26
27 6. Under **Clients**, click **Create client**. Set **Application type** to **Web application**, name the client, and add this URI under **Authorized redirect URIs**:
28
29 ```
30 https://backend.composio.dev/api/v1/auth-apps/add
31 ```
32
33 It must exactly match the `oauth_redirect_uri` field of your Composio auth config.
34
35 ![Create OAuth client ID form with Web application selected](/images/toolkits/shared/sA0bvCBPtMCWw8lqecCrx76Dyc.webp)
36
37 ![Create OAuth client ID form with the Composio redirect URI under Authorized redirect URIs](/images/toolkits/shared/jDTS80dlfwHF6u1WAQhBdnjTrI.webp)
38
39 7. Click **Create**. Copy the **Client ID** and **Client secret** before you close the dialog, and store the secret privately.
40
41 ![OAuth client created dialog with the Client ID and Client secret](/images/toolkits/shared/YdKWAswsL2nVXnSbA4zgBUDmwA.webp)
42
43 ### Create the auth config in Composio
44
45 1. In the [Composio dashboard](https://dashboard.composio.dev/~/project/auth-configs?utm_source=docs&utm_medium=content&utm_campaign=toolkits-googledocs), go to **Auth Configs** → **Create** and select **Google Docs**. Enter a config name and click **Next**.
46
47 ![Composio Auth Configs page with the Create button](/images/toolkits/shared/DUtMN0UWIU2kEqnvS5DvD7qhWU.webp)
48
49 ![Create Auth Config dialog with Google Docs in the toolkit search results](/images/toolkits/googledocs/composio-select-toolkit.webp)
50
51 ![Config Name field for the new Google Docs auth config](/images/toolkits/googledocs/composio-config-name.webp)
52
53 2. Choose **OAuth 2.0** and **Your Own Credentials**. Paste the **Client ID** and **Client secret**, and leave **Redirect URI** set to `https://backend.composio.dev/api/v1/auth-apps/add`.
54
55 ![Google Docs auth config form with Client ID, Client secret, the Composio redirect URI, and a selected scope](/images/toolkits/googledocs/composio-auth-config-form.webp)
56
57 3. Choose the scopes your tools need, matching the ones you added under **Data Access**, then click **Create Auth Config**.
58 4. Click **Connect Account**, sign in with a Google account that can use the app (a test user while the app is in **Testing**), and approve the consent screen. Under **Accounts**, confirm the connection shows **Active**.
59
60 ![Google's unverified-app notice for an app in Testing](/images/toolkits/shared/M0mS4XrLbK5mU52ry578MBa7M.webp)
61
62 ![Google consent screen asking to see all Google Docs documents](/images/toolkits/googledocs/google-consent-screen.webp)
63
64 ![Google Docs auth config details with an Active connected account](/images/toolkits/googledocs/composio-connected-account-active.webp)
65
66 For the general flow, see [custom auth configs](/docs/auth-configuration/custom-auth-configs).
67
68 ### Scopes
69
70 The default Google Docs auth config requests `https://www.googleapis.com/auth/documents`, `https://www.googleapis.com/auth/drive`, and `userinfo.email`. To only read documents by ID, `documents.readonly` is enough. Editing needs `documents`, and finding documents through Drive needs a Drive scope. See Google's [Docs scope reference](https://developers.google.com/workspace/docs/api/auth).
71
72 Short scope names on this page leave out the `https://www.googleapis.com/auth/` prefix. When you paste a scope under **Manually add scopes**, use the full URL, for example `https://www.googleapis.com/auth/userinfo.email`. Scopes already written as a full URL, such as `https://mail.google.com/`, go in as shown.
73
74 If you change the scopes later, reconnect the account so the user grants the new access.
75
76 ### Testing, publishing, and verification
77
78 - While an External app is in **Testing**, only test users can connect, and Google can show them an unverified-app notice. Google generally expires their authorizations after seven days, so they need to reconnect.
79 - To let any Google account connect, publish the app under **Audience**. Publishing doesn't verify the app.
80 - Public apps that request sensitive or restricted scopes generally need Google's OAuth verification. Check **Google Auth Platform** → **Verification Center**. Internal apps and apps in Testing can be exempt. See Google's [verification requirements](https://developers.google.com/identity/protocols/oauth2/production-readiness/overview).
81 - The default `drive` scope is restricted. A public app that requests it needs restricted-scope verification, which can include a security assessment.
82 - If Google blocks sign-in, check the app's audience, the test user list, the requested scopes, and your Workspace admin's app access policy.
83
84 ## Why am I seeing "App is blocked" when connecting Google Docs?
85
86 The OAuth client is requesting scopes that Google hasn't verified for that client. This usually happens when you add extra scopes beyond the defaults.
87
88 Remove the additional scopes from your auth config, or create your own OAuth app and submit the scopes for verification, as described in the setup steps above.
89
90 ## Why am I getting "Google Docs API has not been used in project" error?
91
92 When using custom OAuth credentials, the Google Docs API must be enabled in the Google Cloud project that owns those credentials. Enable it in Google Cloud Console under APIs & Services, wait a few minutes, and retry.
93
94 ## Why am I getting "Error 400: invalid_scope"?
95
96 The requested scopes are invalid or incorrectly formatted in the authorization URL. Verify your scope values against the [Google OAuth scopes docs](https://developers.google.com/identity/protocols/oauth2). If you're creating auth configs programmatically, see the [programmatic auth config guide](/docs/authentication/programmatic-auth-configs).
97
98 ## Why does the OAuth consent screen show "Composio" instead of my app?
99
100 By default, the consent screen uses Composio's OAuth app. To show your own app name and logo, create your own OAuth app and set a custom redirect URL. See [White-labeling authentication](/docs/authentication/white-labeling-authentication#using-your-own-oauth-apps).
101
102 ## Why am I getting 401 errors on tool calls?
103
104 The user's access token is no longer valid. Common causes: the user revoked access, changed their password or 2FA, a Workspace admin policy changed, or Google's refresh token limit was exceeded. Re-authenticating the user typically resolves this.
105
106 ## Why am I getting "Quota Exhausted" or "rate limit exhausted"?
107
108 Google enforces per-minute and daily request quotas. If you're using Composio's default OAuth app, you share that quota with other users, which can cause limits to be hit faster. Use your own OAuth app credentials to get a dedicated quota, and add exponential backoff and retries to handle transient rate limits.