Skip to main content

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

Workflow preview

Workflow preview
100%
Automatic Google Cloud Run auth with JWT token management (sub-workflow) preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

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 che...

Best for

  • Engineering automation workflows
  • Multimodal AI automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.if, n8n-nodes-base.set, n8n-nodes-base.merge, n8n-nodes-base.jwt, n8n-nodes-base.stickynote, n8n-nodes-base.executeworkflowtrigger, n8n-nodes-base.httprequest

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Marco Cassar.

Original n8n.io source

1.1 Workflow description

Title
Automatic Google Cloud Run auth with JWT token management (sub-workflow)
Workflow name
Automatic Google Cloud Run auth with JWT token management (sub-workflow)

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

  • Add your JWT (PEM) credential using the service account private_key.
  • In Vars, set client_email (from your key) and confirm token_uri is https://oauth2.googleapis.com/token.
  • Call this sub-workflow with service_url (and optional service_path). Optionally include a prior id_token to enable reuse.

Inputs / Outputs

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

Notes

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - If Token

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 2 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 3 - Return Values

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 4 - Combine Context

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.2

Block 5 - Raise Id

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Decode JWT

Type / Role
n8n-nodes-base.jwt - jwt
Config choices
Version 1

Block 7 - Sign New JWT

Type / Role
n8n-nodes-base.jwt - jwt
Config choices
Version 1

Block 8 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 9 - Sticky Note2

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 10 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 11 - Start

Type / Role
n8n-nodes-base.executeWorkflowTrigger - executeWorkflowTrigger
Config choices
Version 1.1

Block 12 - Bearer YOUR_TOKEN_HERE Request

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 13 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 14 - Vars

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 15 - Sticky Note5

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 16 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Automatic Google Cloud Run auth with JWT token management (sub-workflow)
Complexity advanced
Nodes 16
Categories Engineering, Multimodal AI
Author Marco Cassar
Published 19 Aug 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/7569/7569.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatic Google Cloud Run auth with JWT token management (sub-workflow) do?

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 che...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, Multimodal AI use case.