OpenClaw Setup Guide: How to Connect Google Workspace Securely
OpenClaw is currently the fastest-growing open-source AI project of all time. But here’s the thing: despite all the hype, there isn't a single good guide on how to actually set this thing up securely in the cloud and connect it to the one tool that makes it useful—your Google account.
Most AI influencers skip this step because connecting OpenClaw to Google Workspace is a giant pain in the butt. They show you the easy stuff and leave you hanging on the complex authentication protocols.
To set up OpenClaw properly, you need to host it on a VPS (like Hostinger), install the gog CLI tool manually, and use an SSH tunnel to authenticate your Google credentials. I’ve tested this extensively, and if you don't follow a specific security protocol, you are essentially handing the keys to your entire digital kingdom to a bot.
Here is exactly how to get OpenClaw up and running, connected to Telegram, and integrated with Gmail and Calendar without compromising your security.
Where Should You Host OpenClaw?
You have three main options for where this AI agent lives.
- A Mac Mini: This is what you see in most demos. It works great, but it’s expensive. You’re looking at $400 to $600 just for the hardware, and it has to sit on your desk running 24/7.
- Your Local Machine: You can run it right on your laptop. The problem? If you close your laptop, your AI employee dies. For an assistant meant to manage your life, that’s useless.
- A Cloud VPS (Virtual Private Server): This is the sweet spot. You pay a third-party provider about $7 to $10 a month to host it on their servers.
I recommend the VPS route. It’s cheaper than buying a Mac Mini, it runs 24/7, and it keeps the AI isolated from your personal files. For this setup, I use Hostinger because it offers a KVM2 plan that provides plenty of power for about seven bucks.
Critical Setup Note: When setting up your VPS, choose Ubuntu 24.04 LTS. Do not use the "One-Click OpenClaw Install" that some hosts offer. We need to install it manually via the terminal to ensure we have the root access required for the Google integration later.
How Do You Install OpenClaw Manually?
Once you have purchased your VPS, you’ll get an IP address and a root password. You need to SSH (Secure Shell) into that server. This sounds technical, but it just means using your computer's terminal to control the cloud computer.
Open your terminal and type:
ssh root@YOUR_VPS_IP_ADDRESS
Once you’re in, head to the OpenClaw website, grab the Linux installation command, and paste it in. When it asks for configuration:
- Onboarding Mode: Choose Quick Start.
- LLM Provider: I suggest starting with OpenAI (GPT-4o or Mini). Many people suggest Anthropic, but OpenClaw is extremely token-heavy. Anthropic can get very expensive very quickly. OpenAI is a cheaper testing ground.
- Channel: Use Telegram. It’s free and easy. You just message the "BotFather" on Telegram to get a token, paste it into your terminal, and you’re done.
At this point, you have a bot you can chat with on Telegram. That’s the easy part. Now we have to make it useful.
Why Should You Create a Separate Google Identity?
Most people try to connect their main Gmail account to their AI agent. This is a mistake.
We need to operate on the principle of Least Privilege. If something goes wrong with the code or a bad actor gets access, you don't want them having read/write access to every email you’ve sent for the last 10 years.
Instead, go to Google Workspace and create a dedicated email for your agent (e.g., agent@yourdomain.com).
- The agent gets its own inbox.
- You "invite" the agent to your personal calendar events.
- You share specific Drive folders with the agent.
This allows the agent to do its job (checking schedules, sending emails) without risking your primary identity.
How Do You Navigate the Google Cloud Console Setup?
This is the part that breaks most installations. You need to enable the APIs that allow OpenClaw to talk to Google.
- Go to console.cloud.google.com and make sure you are logged in as the Agent’s account, not yours.
- Create a New Project.
- Go to APIs & Services > Library and enable: Gmail API, Google Calendar API, and Google Drive API.
- Go to OAuth Consent Screen: Set it to "External" and fill in the required contact info.
- Publish the App. Do not leave it in testing mode, or the tokens will expire effectively every week.
- Go to Credentials > Create Credentials > OAuth Client ID. Select "Desktop App."
Download the JSON file it generates. This is your digital key. You need to move this file from your computer to your VPS. The command for this is:
scp /path/to/your/downloaded.json root@YOUR_VPS_IP:/root/
How Do You Authenticate gog Without a Browser?
Here is where it gets interesting. OpenClaw uses a tool called gog (Google via Go) to handle authentication. You install it on your VPS, and then you run a command to add your account:
gog auth add agent@yourdomain.com google_drive,gmail,calendar
The Problem: When you run this on a VPS, it spits out a long URL and says "Click this to authenticate." But since your VPS has no web browser, clicking it won't work. The localhost redirect will fail because the browser is on your computer, but the request is coming from the cloud computer.
The Solution: You must set up an SSH tunnel.
- Copy the URL the VPS gives you.
- Paste it into ChatGPT or Claude and ask: "I am setting up OpenClaw on a VPS. I got this auth URL. Give me the exact SSH tunnel command to run on my local machine to forward the port."
- It will give you a command that looks like:
ssh -L 8080:localhost:8080 root@YOUR_VPS_IP. - Open a second terminal window on your local computer and run that command.
- Now, paste the auth link into your local browser. Google will think you are on the VPS. Authorize the app.
Once authenticated, gog will generate a keyring password. You need to save this in your OpenClaw environment variables (using nano .env) so the bot doesn't ask for a password every time it tries to send an email.
Is OpenClaw Actually Worth The Hype?
After going through this setup, I tested the bot by asking it to email me and schedule a meeting. It worked perfectly. I could see the invite on my calendar and the email in my inbox.
But here’s my honest take: OpenClaw isn't doing anything we couldn't do before.
We’ve been able to run Python scripts to send emails and manage calendars for years. The automation logic isn't novel. However, the packaging is excellent. Being able to open Telegram, speak naturally to a bot, and have it execute complex backend tasks without me opening a dashboard is valuable.
It’s a very powerful personal assistant interface. just remember that under the hood, it’s still just scripts and APIs. If you take the time to set up the Google integration securely, it can save you hours of admin work every week. Just don't skip the security steps—your digital life depends on it.
FAQs
Can I use a free Gmail account for OpenClaw?
Yes, you can use a standard @gmail.com address. However, I highly recommend creating a separate Google account just for the bot rather than connecting your primary personal email. This limits the damage if the bot is ever compromised.
Why do I need to use the SSH tunnel method?
OAuth authentication requires a browser callback to a "localhost" port. Since your VPS is a server without a display or browser, the callback fails. The SSH tunnel forwards your local computer's browser traffic to the VPS, tricking Google into thinking the authentication happened locally.
How much does running OpenClaw cost?
The fixed cost is the VPS hosting (around $7/month). The variable cost is the LLM token usage. If you use GPT-4o or Claude Sonnet, heavy usage could cost $20-$50/month. Using smaller models like GPT-4o-mini will keep costs significantly lower.
If you want to go deeper into builds like this, join the free Chase AI community for templates, prompts, and live breakdowns.


