OAuth 2.0 Token Refresh automatically manages and renews authentication tokens during
long-running AI red teaming scans to prevent interruptions from expired
credentials.
AI Red Teaming OAuth Token Refresh enables you to configure long-running AI
red teaming scans against target APIs that require authentication, eliminating scan
interruptions caused by expired credentials. When you configure a target in AI Red
Teaming, you select one of
three authentication methods: Using
Headers or Using Payloads, or OAuth2.0. AI Red Teaming securely stores all
authentication credentials in Google Secret Manager and automatically injects the
appropriate authentication headers into each API request during scan execution.
For targets that use OAuth2-based authentication, AI Red Teaming manages
the complete token lifecycle without requiring manual intervention. The system
fetches an initial access token from your OAuth2 provider's token endpoint using the
client credentials you configure, caches the token in memory, and proactively
refreshes it before expiration based on a configurable buffer period that defaults
to five minutes. If a token expires unexpectedly or is revoked by the provider, AI
Red Teaming detects authentication errors during scan execution, invalidates the
cached token, requests a fresh token from the provider, and automatically retries
the failed request. This reactive refresh mechanism ensures that your scans continue
uninterrupted even when tokens expire earlier than expected due to policy changes or
service interruptions.
You should use OAuth Token Refresh when you need to run extended red
teaming campaigns against enterprise AI systems protected by modern authentication
mechanisms. For instance, Azure OpenAI deployments secured with Entra ID issue
access tokens that expire after 60 minutes, which is typically shorter than the
duration of comprehensive static attack jobs that generate thousands of adversarial
prompts or dynamic agent jobs that execute multi-turn conversation flows. Without
automatic token refresh, these scans would fail mid-execution with authentication
errors, requiring you to manually restart the job and potentially losing progress.
Similarly, Databricks Model Serving endpoints and custom enterprise APIs
increasingly require OAuth2 client credentials for secure API access. With AI Red
Teaming OAuth Token Refresh, you can test these protected endpoints continuously
without managing token expiration manually.
The feature also addresses compliance and security requirements by
centralizing credential storage in Google Secret Manager rather than exposing
secrets in configuration snapshots or API responses. When you view or edit a target
configuration, all sensitive authentication values are redacted to masked
placeholders, and the system preserves your original credentials when you submit
updates without changing them. This approach prevents credential leakage through
logs, API responses, or configuration exports while maintaining operational
flexibility. For targets deployed behind private networks, AI Red Teaming routes
both API requests and OAuth2 token requests through the Network Channel service with
automatic fallback to direct connectivity when the token endpoint is publicly
accessible, ensuring that authentication works seamlessly regardless of your network
topology.