If you’ve ever explored workflow automation tools, you’ve likely come across n8n — a flexible, open-source alternative to services like Zapier. While n8n Cloud offers convenience, self-hosting it can unlock a new level of control and customization. You decide where your data lives, how your workflows run, and what integrations you enable, all without cloud-imposed limits.
But there’s one part that often intimidates new users: setting up Google Sign-In authentication for self-hosted n8n. Between OAuth settings, redirect URIs, and HTTPS requirements, it can feel like walking through a maze of configuration screens. The good news? Once you understand the sequence and key environment variables, it’s actually quite manageable.
This post guides you through setting up self-hosted n8n with Google OAuth, utilizing Pinggy to establish a secure HTTPS tunnel, a crucial requirement for OAuth callbacks. By the end, you’ll have your own instance of n8n running locally, capable of authenticating Google services like Drive, Sheets, and Gmail.
Why Self-Host n8n?
Before diving in, let’s take a moment to understand why self-hosting n8n might be worth the effort.
When you self-host, you own your data. Every workflow, credential, and API token stays on your system. This is crucial if you’re dealing with confidential data or work in a regulated industry. Self-hosting also removes restrictions on the number of workflows or executions — so you can automate as much as you want, without worrying about subscription tiers.
Perhaps the most exciting part? Unlimited customization. You can add your own nodes, integrate internal systems, or tailor authentication methods (like Google Sign-In) to fit your organization’s needs.
What You’ll Need
Before you begin, make sure you have the following ready:
- Node.js v18.10 or higher
- npm (included with Node.js)
- A Google account (to create OAuth credentials)
- A stable internet connection
- Pinggy account (for creating HTTPS tunnel; Pro plan recommended for OAuth)
- Basic comfort with terminal commands
You can verify Node.js is installed by running:
node --version
If it’s not, download the latest LTS version from nodejs.org.
Step 1: Install n8n via npm
Installing n8n through npm is the simplest way to get started. Open your terminal and run:
npm install -g n8n
This installs n8n globally, letting you start it from anywhere.
If you’d rather not install it globally, you can use npx to run it directly:
npx n8n start
We won’t start n8n just yet — first, we need to create a secure public URL for it.
Step 2: Create an HTTPS Tunnel with Pinggy
Google OAuth requires HTTPS for redirect URIs, which means your local n8n instance needs a secure public address. That’s where Pinggy comes in — it creates a tunnel that exposes your local server to the web via an HTTPS URL.
Run the following command (after logging into Pinggy):
ssh -p 443 -R0:localhost:5678 a.pinggy.io
Within seconds, you’ll get an HTTPS URL like:
https://mysite.a.pinggy.link
Keep this terminal open. Closing it will terminate the tunnel and break your connection.
Step 3: Start n8n with the WEBHOOK_URL
Next, start n8n with your Pinggy URL as the WEBHOOK_URL environment variable. This tells n8n where to receive OAuth callbacks.
In a new terminal window:
WEBHOOK_URL="https://mysite.a.pinggy.link" n8n start
Or, if you’re using npx:
WEBHOOK_URL="https://mysite.a.pinggy.link" npx n8n start
Now, n8n will start running on port 5678 — accessible via your Pinggy link.
Step 4: Access n8n and Copy the Redirect URL
Open your Pinggy URL in a browser (e.g., https://mysite.a.pinggy.link). Create an account if you haven’t already.
Once inside n8n, create a new workflow. Add a node that connects to any Google service — such as Google Drive or Google Sheets.
When you create new credentials for this node, n8n will show you a redirect URL similar to:
https://mysite.a.pinggy.link/rest/oauth2-credential/callback
Copy this URL — you’ll need it when setting up OAuth credentials in the Google Cloud Console.
Step 5: Configure Google Cloud Console
Go to Google Cloud Console and create a new project (or select an existing one).
1. Create OAuth Credentials
- Navigate to APIs & Services → Credentials
- Click Create Credentials → OAuth 2.0 Client ID
- Choose Web application
- Set the authorized origins to your Pinggy URL:
https://mysite.a.pinggy.link
- Set the redirect URI to the n8n callback URL you copied earlier:
https://mysite.a.pinggy.link/rest/oauth2-credential/callback
After saving, you’ll get a Client ID and Client Secret — keep them handy.
2. Enable APIs
Head to APIs & Services → Library, and enable any Google APIs your workflow will use — for example:
- Google Drive API
- Google Sheets API
- Gmail API
3. Configure the OAuth Consent Screen
In the sidebar, navigate to OAuth consent screen, select External, and enter your app details.
Then, under Test Users, add your email so you can authorize during testing.
Step 6: Complete the Setup in n8n
Back in n8n, open your Google node’s credential setup. Enter the Client ID and Client Secret from the Google Cloud Console, then click Connect my account.
You’ll be redirected to a Google Sign-In page. Log in with your test user account and grant permissions.
If Google shows a warning that the app isn’t verified, click Advanced → Go to unsafe app (safe for development mode).
Once authorized, n8n will save your credentials and confirm a successful connection.
Step 7: Test Your Integration
Now, it’s time to test.
Try running a simple workflow — for example, listing files from Google Drive or reading rows from a Google Sheet.
Click Execute Workflow, and watch n8n fetch data using your new OAuth credentials.
If everything runs smoothly, congratulations — your self-hosted n8n with Google OAuth is fully operational.
Conclusion
At first glance, self-hosting n8n with Google OAuth might seem complex, but it really comes down to following the right order:
- Set up a Pinggy tunnel to get a secure URL
- Use that URL in your n8n and Google OAuth configurations
- Test and refine your connection
Once it’s running, you gain a powerful, secure automation system with complete data control — ideal for developers, researchers, or small teams who want the flexibility of n8n without cloud constraints.
Whether you’re syncing Google Sheets, automating Gmail tasks, or building end-to-end document workflows, this setup gives you both freedom and reliability.
For long-term or production use, consider keeping your Pinggy URL stable with a Pro plan, ensuring OAuth callbacks stay consistent.
In the end, the effort pays off — a self-contained automation engine, integrated with Google, entirely under your control.








Top comments (0)