⚒️ Automatic Google Cloud Run auth with JWT token management (sub-workflow)

445 views · ⚒️ Engineering

Description

Who it’s for?

Anyone calling a Google Cloud Run service from n8n who wants a small, reusable auth layer instead of wiring tokens in every workflow.

What it does / How it works

This sub-workflow checks whether an incoming id_token exists and is still valid (with a 5-minute buffer). If it’s good, it reuses it. If not, it signs a short-lived JWT with your service account, exchanges it at Google’s token endpoint, and returns a fresh id_token. It also passes through service_url and an optional service_path so the caller can hit the endpoint right away. (Designed to be called via Execute Workflow from your main flow.)

How to set up

Inputs / Outputs

Inputs: id_token (optional), service_url, service_path
Outputs: id_token, service_url, service_path

Notes

🔗 Nodes Used

HTTP Request, Execute Workflow Trigger, JWT

📥 Import

Download workflow.json and import into n8n: Workflow menu → Import from File

📖 Importing guide · 🔑 Credential setup