Amazon Bedrock AgentCore has added built‑in support for three OAuth flows that let an AI agent call the Snowflake‑managed MCP server used by Snowflake Cortex tools. The change introduces a credential‑broker layer that fetches, caches, and refreshes tokens on behalf of the agent, eliminating the need for static service‑account keys and enabling per‑user attribution.
OAuth patterns supported for Snowflake Cortex
AgentCore Identity can be configured with one of three grant types:
- Snowflake‑hosted OAuth (3‑legged Authorization Code) – Snowflake acts as the authorization server. Each user authenticates directly to Snowflake using the
authorization_codegrant. No external IdP is required. - Three‑legged OAuth with a corporate IdP – Users sign in through an existing SSO provider (Okta, Microsoft Entra ID, etc.) using the
authorization_codegrant. Snowflake trusts the IdP‑issued JWT via an External OAuth security integration. - Two‑legged OAuth with a corporate IdP – A shared service account authenticates using the
client_credentialsgrant. No interactive consent is needed, making it suitable for machine‑to‑machine workloads.
All three patterns rely on a credential provider in AgentCore Identity (CustomOauth2, OktaOauth2, or MicrosoftOauth2) and a matching Snowflake security integration. An optional on‑behalf‑of (OBO) grant (TOKEN_EXCHANGE) can deliver per‑user identity for unattended jobs without a consent prompt.
Token acquisition flow inside AgentCore
The outbound authentication sequence is fixed:
- The Bedrock AgentCore Gateway receives a request from the agent, authenticated inbound with a JWT.
- AgentCore Identity calls
GetWorkloadAccessTokenForJWTto obtain a workload token tied to the inbound JWT. - Using that workload token, AgentCore Identity invokes
GetResourceOauth2Tokenagainst the configured OAuth provider. - The returned access token is stored in the internal token vault, automatically refreshed, and presented to the Snowflake MCP server.
This separation keeps inbound identity (the agent’s JWT) distinct from outbound credentials (the OAuth token) and centralises token lifecycle management.
Security and operational implications
Choosing a pattern influences both security posture and operational overhead:
- Snowflake‑only OAuth simplifies the trust chain but ties user management to Snowflake’s built‑in OAuth server. It requires configuring the
OAUTH_AUTHORIZATION_SERVERissuer lock, session role/scope grammar, and mapping ofLOGIN_NAMEorEMAIL_ADDRESSto Snowflake identities. Query history attribution is automatically linked to the authenticated user. - External IdP (3‑legged) leverages existing corporate SSO, reducing duplicate user stores. However, Snowflake must be configured to accept the IdP’s JWT claims, scopes, and audience. Practitioners need to verify that the IdP’s token contains the claims expected by Snowflake’s External OAuth integration.
- External IdP (2‑legged) removes interactive consent, which is ideal for batch jobs or services. The trade‑off is loss of per‑user attribution unless an OBO flow is added. Token rotation is handled by AgentCore, but the service account’s client secret or certificate must be protected.
All patterns benefit from AgentCore’s automatic token refresh, but operators should monitor the token vault for expiration anomalies and ensure that the underlying IdP’s token lifetimes align with Snowflake’s session expectations.
Related CloudNinjas coverage: AWS.
What This Means For Practitioners
When integrating Bedrock agents with Snowflake Cortex, select the OAuth flow that matches your identity strategy: use Snowflake‑hosted OAuth for isolated Snowflake environments, adopt three‑legged OAuth to reuse corporate SSO, or employ two‑legged OAuth for service‑to‑service calls. Validate claim mappings, audience values, and role‑scope settings in Snowflake’s security integration. Leverage AgentCore Identity’s token vault to offload refresh logic, but keep an eye on token lifetimes and vault health. Finally, consider the OBO grant if you need per‑user context for unattended workloads without prompting users.


