Connect Google Workspace (Gmail, Calendar, Docs, Sheets)

This guide walks you through connecting a Google account to Insynia so that Brain can read your Gmail, Google Calendar, Google Docs, and Google Sheets.

Because Brain runs in an isolated, short-lived sandbox, you bring your own Google Cloud OAuth client and authorize a Google account once per project. Connecting any one of the four tiles (Gmail, Calendar, Docs, Sheets) enables all four at once.

Before you start

  • You need access to the Google Cloud Console. Any Google account can create a free Cloud project; no billing is required for these APIs.
  • Have a project selected inside Insynia — the connection is stored per project.

1. Create a Google Cloud project

  1. Open the project creation page.
  2. Give the project a recognizable name (e.g. insynia-workspace) and click Create.
  3. Once created, make sure it is selected in the project picker at the top of the console.
Google Cloud New Project form with a project name filled in
Step 1 — Create a Google Cloud project.

2. Enable the required APIs

Insynia needs the following APIs enabled in the same project that will own your OAuth client. Open each link (with your new project selected) and click Enable.

You can also browse the full API Library and search for each API by name.

Google Cloud API Library showing the Enable button for a required API
Step 2 — Enable Gmail, Calendar, Docs, Sheets, and Drive APIs.

4. Create a Desktop OAuth client

  1. Open the Credentials / Clients page.
  2. Click Create client (or Create credentials → OAuth client ID).
  3. For Application type, select Desktop app. This is important — Insynia's headless flow relies on a Desktop client.
  4. Name it (e.g. Insynia Desktop) and click Create.
  5. In the confirmation dialog, click Download JSON. This file is your client_secret_*.json.
Create OAuth client form with Desktop app selected
Step 4 — Create a Desktop app OAuth client.
OAuth client created dialog with the Download JSON button
Step 4 — Download the client secret JSON.

5. Start the connection in Insynia

  1. In Insynia, go to Tools.
  2. Select the project you want to connect (the connection is stored per project).
  3. Find any Google Workspace tile — Gmail, Google Calendar, Google Docs, or Google Sheets — and click Connect Google. Connecting one enables all four.
  4. In the dialog, enter your Google account email and paste the entire contents of the client_secret_*.json file into OAuth client JSON.
  5. Click Get authorize link.
Insynia connect dialog with the email and OAuth client JSON fields
Step 5 — Paste your account email and client JSON into Insynia.

6. Authorize and finish

After clicking Get authorize link, Insynia opens a Google authorization page in a new tab.

  1. Choose the Google account you want to connect.
  2. You may see an "unverified app" warning (expected for personal OAuth apps). Click Advanced → Go to <your app name> (unsafe) to continue.
  3. Review the requested permissions and click Allow.
  4. Google redirects you to a URL (often a http://localhost… page that may not load). Copy the full URL from your browser's address bar — it contains a code=… value.
  5. Back in Insynia, paste that URL into Redirect URL (or authorization code) and click Finish connecting.
Google Allow access screen listing Gmail, Calendar, Docs, and Sheets permissions
Step 6 — Grant access on Google.
Browser address bar showing the localhost redirect URL containing code=
Step 6 — Copy the redirect URL from the address bar.
Insynia connect dialog step 2 with the redirect URL pasted and Finish connecting
Step 6 — Paste the redirect URL and finish connecting.
Insynia Tools page tiles showing Connected with the account email
Connected — the tiles now show the linked Google account.

7. Try it in Brain

Open Brain for the connected project and ask something that uses your data, for example:

  • "Summarize my unread emails from the last 7 days."
  • "What's on my calendar today?"
  • "Read the contents of this Google Doc: <docId>."
  • "Get the values in Sheet1!A1:D20 from spreadsheet <spreadsheetId>."

Brain works with your connected account on your behalf.

Managing or disconnecting

  • Click Manage on any Google Workspace tile to see the connected account or to Disconnect.
  • Disconnecting removes the stored credentials for that project. To reconnect, start again from Step 5 — your Google Cloud setup from Steps 1–4 can be reused.

Troubleshooting

  • "client_secret_json must be a Google OAuth client file" — You pasted the wrong file or partial text. Paste the full contents of the downloaded client_secret_*.json (it contains an "installed" key for Desktop clients).
  • Nothing happens on finish / "redirect_url is required" — Make sure you copied the entire redirect URL (it contains code=).
  • accessNotConfigured errors in Brain — One of the required APIs (Step 2) is not enabled in the same project. Enable it and retry.
  • Connection stops working after ~7 days — Your OAuth app is still in Testing. Publish the consent screen (Step 3) for long-lived tokens, then reconnect.
  • The account isn't allowed on the authorization page — Add it under Test users on the consent screen (Step 3), or publish the app.

Reference