Skip to content

Error: Invalid JWT audience. When connecting to Cloud Run using IAP #496

@IsmailMehdi

Description

@IsmailMehdi

Prerequisites

  • I've searched the current open issues
  • I've updated to the latest version of Toolbox
  • I've updated to the latest version of the SDK

Toolbox version

toolbox version 0.23.0+binary.linux.amd64.466aef0

Environment

  1. OS type and version: (output of uname -a): Linux bastion-evalbench-20251212-222704 6.17.0-1005-gcp feat!: Add Toolbox LangChain SDK code from 'main' branch of https://g… #5-Ubuntu SMP Sat Nov 22 06:06:50 UTC 2025 x86_64 GNU/Linux
  2. How are you running Toolbox:
  • As a container (e.g. from us-central1-docker.pkg.dev/database-toolbox/toolbox/toolbox:$VERSION) in cloudrun
  1. Python version (output of python --version): Python 3.13.7
  2. pip version (output of pip --version):
    uv 0.9.18

Client

  1. Client: sample python
  2. Version: (pip show <package-name>)? e.g.
  • toolbox-core version 0.5.4
  1. Example: If possible, please include your code of configuration:
# Code goes here! 
import asyncio
from toolbox_core import ToolboxClient, auth_methods

# Replace with the Cloud Run service URL generated in the previous step
URL = "https://toolbox-dataagent-898603957982.us-central1.run.app"

auth_token_provider = auth_methods.get_google_id_token(URL)  # can also use sync method


async def main():
    async with ToolboxClient(
        URL,
        client_headers={"Authorization": auth_token_provider},
    ) as toolbox:
        toolset = await toolbox.load_toolset()
        print(toolset)


asyncio.run(main())

Expected Behavior

The client should be able to connect to toolbox and load the toolset.

Current Behavior

RuntimeError: API request failed with status 401 (Unauthorized). Server response: Invalid IAP credentials: Invalid bearer token. Invalid JWT audience.

Steps to reproduce?

  1. ?
  2. ?
  3. ?
    ...

Additional Details

Toolbox is deployed into Cloud Run with "Enable IAP from Cloud Run" enabled and users added to the binding.

Metadata

Metadata

Assignees

Labels

priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions