Skip to content

Google ADK Authentication Token Not Passed to Tool Context #267

Closed

Description

@MagnusDot

Bug Report: Google ADK Authentication Token Not Passed to Tool Context

Describe the bug

When using Google ADK with HTTP Bearer authentication, the bearer token provided in the request is not properly passed to the tool_context in custom tools. The tool_context.actions.requested_auth_configs dictionary remains empty even when authentication information is properly provided in the request.

To Reproduce

Steps to reproduce the behavior:

  1. Create a custom tool that requires authentication using the ADK framework
  2. Configure the tool to use HTTP Bearer authentication
  3. Send a request with authentication information in one of these ways:
    • HTTP Authorization header with a Bearer token
    • In the request body under actions.requested_auth_configs
  4. In the tool, attempt to access tool_context.actions.requested_auth_configs
  5. See that the dictionary is empty and the token is not accessible

Expected behavior

When a bearer token is provided in the request (either through headers or in the body), ADK should pass this token to the tool through tool_context.actions.requested_auth_configs, making it accessible using the standard ADK authentication flow with tool_context.get_auth_response().

Screenshots

N/A

Desktop (please complete the following information):

  • OS: macOS 24.4.0
  • Python version: 3.13
  • ADK version: The latest version (as installed by default in April 2025)

Additional context

This appears to be an issue with how ADK's main runner processes authentication information. In the code of runners.py, the authentication information from the request body is not properly transferred to the event_actions object that's passed to the tool_context.

Activity

  1. MagnusDot commented on Apr 18, 2025

    @MagnusDot
    Author

    { "app_name": "ServaneAI", "user_id": "1", "session_id": "21fa9be4-12d0-4c64-af80-5a3c168fdcfc", "new_message": { "parts": [ { "text": "what time is it in new york" } ], "role": "User" }, "streaming": false }

    the body passed to the /run

    and the headers :

    Image
  2. added theissue type on Apr 18, 2025
  3. dkmin commented on Apr 19, 2025

    @dkmin

    +1

  4. MagnusDot commented on Apr 20, 2025

    @MagnusDot
    Author

    I made a MR to repare it

  5. seanzhou1023 commented on May 27, 2025

    @seanzhou1023
    Collaborator

    sorry we didn't provide enough documents.

    auth response is not passed in this way. It should be only passed as a function response to adk_request_credential, please see : https://github.com/google/adk-docs/blob/main/docs/tools/authentication.md

    tool_context.actions.requested_auth_configs is not something that is supposed to be touch out of adk.

  6. seanzhou1023 commented on May 27, 2025

    @seanzhou1023
    Collaborator

    and this is only used when tools are requesting credential on demand. e.g. :

    and client send back the auth credential as response.

    If client needs to actively pass in auth credential to tools, you can directly pass in the session.state, and if you want it to be removed after one invocation you can append the key with 'temp:' namespace, see https://google.github.io/adk-docs/tools/#state-management

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions