Back to catalog / Agent authorization
Connect an agent to a third-party data tool with user authorization
Pause a run when a tool needs the user’s credential, complete the external consent flow, and resume the waiting call.
Goal
Access third-party data only with scopes explicitly granted by the user, without exposing long-lived credentials to the agent.
Steps
- Identify resources accessed for one user and the OAuth scopes supported by the provider. [auth]
- Declare OAuth with
AuthConfig(auth_scheme=..., raw_auth_credential=..., credential_key="documents_api")and configure a credential service for CredentialManager. [auth] - When authorization interrupts the run, send the user to the provider consent screen; never put tokens in model messages. [auth]
- After callback, validate state and user binding, return credentials securely to the waiting tool, and limit lifetime. [auth]
How to verify
Authorization covers only requested scopes; invalid state, expired tokens, and another user’s token are rejected, with no token in logs.
Troubleshooting
If the tool requests consent again after resume, verify the callback returns the right authorization result to the same user session.
Permissions
Prerequisites
- Python 3.11+, google-adk compatible with the pinned revision, and an isolated test environment
- Configured model-provider credentials for live inference; never place them in code or logs
- Python 3.11+, google-adk, OAuth client registration for the provider, and a test tenant with minimum read scopes.
Permissions
- Use authorized test data only; isolate sessions and credentials per user; obtain human authorization before external side effects
Limitations
This procedure follows Google ADK at the pinned revision; other versions, models, or remote services may differ in APIs and event semantics. Recheck permissions, retention, and recovery before production.
Pinned upstream source
- Repository
- google/adk-python
- File path
- docs/guides/auth/tool_auth/index.md
- Pinned commit
e9b74d36140f2594b24c481fb7a3825b2cb01e96- Source checked
- 2026-10-14 · Reviewed against the pinned upstream source
Repository metrics
These values describe the upstream repository, not popularity or likes for an individual skill or playbook.
- Stars
- Not collected
- Forks
- Not collected
- Observed at
- Not collected
No metrics snapshot is available yet.
License: Apache-2.0