Amazon Web Services published a technical implementation guide on November 17, 2026, detailing three standardized OAuth authentication patterns for routing Amazon Bedrock AgentCore AI agents to Snowflake Cortex AI tools through the Model Context Protocol (MCP). The documentation outlines how enterprises can replace broad service account permissions with granular, per-user or machine-to-machine identity flows without building custom authentication integrations.
As agentic workflows increasingly invoke external data and reasoning tools, bridging corporate identity systems with SaaS platforms has become a critical infrastructure requirement. The guide provides a reference architecture that handles token lifecycle management, role scoping, and query attribution natively, reducing the operational overhead that typically accompanies agent-to-database connectivity.
Three OAuth Architectures for Agentic Workloads
The AWS documentation evaluates three distinct authentication configurations spanning two OAuth grant types: authorization_code and client_credentials. Each pattern routes outbound authentication through Amazon Bedrock AgentCore Identity, which functions as a credential broker that owns the token vault, manages token refresh cycles, and maintains user-to-token bindings.
The first configuration, Snowflake OAuth, operates as a three-legged OAuth (3LO) flow where Snowflake acts as its own authorization server. This pattern requires no external identity provider (IdP) and delivers per-user authentication. The second configuration extends the 3LO flow to a third-party IdP, such as Okta or Microsoft Entra ID, enabling corporate single sign-on (SSO) while Snowflake validates the issued JSON Web Tokens (JWTs) through an External OAuth security integration. The third configuration utilizes a two-legged OAuth (2LO) flow with a third-party IdP, leveraging the client_credentials grant for a shared service user. This machine-to-machine pattern requires no user interaction or consent prompts, making it suitable for unattended workloads.
| Pattern | OAuth Grant | AgentCore Identity Credential Provider | Snowflake Security Integration | Query Identity Mapping |
|---|---|---|---|---|
| Snowflake OAuth (3LO) | authorization_code | CustomOauth2 | TYPE = OAUTH, OAUTH_CLIENT = CUSTOM | Real user with assigned role |
| 3LO with External IdP | authorization_code | OktaOauth2, MicrosoftOauth2 | TYPE = EXTERNAL_OAUTH + OAUTH_AUTHORIZATION_SERVER | Real user with assigned role |
| 2LO with External IdP | client_credentials | OktaOauth2, MicrosoftOauth2, or CustomOauth2 | TYPE = EXTERNAL_OAUTH + OAUTH_AUTHORIZATION_SERVER | Shared Snowflake service user |
Patterns two and three follow standard OAuth flows, meaning they can extend to other OAuth-protected MCP servers provided token claims, scopes, and audience settings are validated. Only the first pattern is Snowflake-specific, relying on Snowflake’s built-in OAuth endpoints and the OAUTH_AUTHORIZATION_SERVER issuer-lock parameter.
Illustrative image: geralt / Pixabay
Token Management and Automatic Refresh
The outbound authentication path remains consistent across all three patterns. When an MCP-aware client requires a Snowflake token, Amazon Bedrock AgentCore Gateway calls GetWorkloadAccessTokenForJWT to obtain a workload token, then invokes GetResourceOauth2Token against the configured provider. If no token exists in the vault, the Gateway returns a JSON-RPC error code -32042 carrying an elicitation URL. The client opens this session-URI-bound URL in a browser, routing the user to the appropriate authorization server.
Upon successful authentication and consent, the authorization server returns an authorization code to the registered callback URL. AgentCore Identity completes the code exchange only after the application calls CompleteResourceTokenAuth with the user identity and session URI, a step that binds the code to the originating request and prevents authorization-URL hijacking. The return URL used here is registered by calling UpdateWorkloadIdentity. In production, the endpoint at that URL is hosted either by the web application or, for gateways with JWT inbound authentication, by the AgentCore Identity Consent Portal at <portal-url>/connect/callback. The agentcore dev CLI hosts it only for local development. The identity broker then exchanges the code at the token endpoint for an access token and, optionally, a refresh token.
Access tokens are short-lived, defaulting to 600 seconds with a maximum of 3600 seconds. When an access token expires, AgentCore Identity automatically uses the refresh token to obtain a new access token without requiring user interaction. Refresh-token lifetime is controlled by the OAUTH_REFRESH_TOKEN_VALIDITY parameter, which the reference implementation sets to 86400 seconds (one day), though Snowflake permits up to 90 days. The OAUTH_ISSUE_REFRESH_TOKENS parameter, defaulting to TRUE, governs whether refresh tokens are issued at all. For unattended workloads requiring per-user identity without a consent prompt, the platform also supports an on-behalf-of (OBO) grant using TOKEN_EXCHANGE.
Role Scoping and Query Attribution
Identity mapping directly impacts auditability and security posture. The Snowflake-managed MCP server advertises session:role:all by default, falling back to DEFAULT_ROLE. To enforce granular access, administrators must configure OAUTH_SCOPES_SUPPORTED at the account, database, or schema level to narrow the advertised role scope. The ALLOWED_ROLES_LIST parameter restricts which roles a user can consent to, while PRE_AUTHORIZED_ROLES_LIST defines roles that bypass the consent step entirely.
Query attribution is handled through Snowflake’s QUERY_HISTORY feature. In the three-legged patterns, the history records the real username and their consented role. In the two-legged pattern, attribution maps to the shared Snowflake service user. The consented scope controls the primary role only. Because secondary roles are governed by the integration, administrators should set OAUTH_USE_SECONDARY_ROLES = NONE (the default) to ensure the session cannot carry more privilege than the consented role. Setting this to IMPLICIT would allow secondary roles to inherit additional privileges.
Illustrative image: geralt / Pixabay
Security hardening is further enforced by BLOCKED_ROLES_LIST for Snowflake OAuth and EXTERNAL_OAUTH_BLOCKED_ROLES_LIST for external integrations. These parameters prevent high-privilege roles such as ACCOUNTADMIN, ORGADMIN, GLOBALORGADMIN, and SECURITYADMIN from being used with OAuth integrations. This restriction applies to the primary role only; if secondary roles are enabled via the IMPLICIT setting, they can still carry these privileged roles.
Configuration Trade-offs and Implementation Steps
The Snowflake OAuth pattern offers the simplest path to per-user audit trails, requiring no external IdP configuration or additional vendor dependency. However, setup follows a strict sequence because the callback URL does not exist until the credential provider is created. Administrators must first create the CustomOauth2 credential provider in AgentCore Identity using placeholder client credentials, which returns a placeholder callbackUrl. This URL is then registered as the redirect URI on a Snowflake security integration created with TYPE = OAUTH and OAUTH_CLIENT = CUSTOM. Finally, the administrator updates the credential provider with the actual client ID and secret issued by Snowflake and configures the provider’s oauthDiscovery with explicit authorization server metadata, including the issuer, the authorization endpoint (/oauth/authorize), and the token endpoint (/oauth/token-request).
For external IdP patterns, Snowflake validates tokens through a TYPE = EXTERNAL_OAUTH security integration. Setting OAUTH_AUTHORIZATION_SERVER via ALTER ACCOUNT, DATABASE, or SCHEMA commands issuer-locks the MCP endpoint to that specific integration. This parameter also allows direct MCP clients to auto-discover the IdP through the Protected Resource Metadata endpoint. If an administrator issuer-locks an MCP scope to an external IdP, Snowflake OAuth tokens are rejected for MCP servers in that scope and do not fall back. To support multiple patterns within a single account, the parameter must be set per schema or database so each scope resolves to the correct authorization server.
The underlying architecture routes user-facing AI applications through a Strands agent on Amazon Bedrock AgentCore Runtime, leveraging Amazon Bedrock for reasoning. Amazon Bedrock Guardrails redact personally identifiable information (PII) from prompts and responses, while Amazon Bedrock Knowledge Bases handle fully managed Retrieval Augmented Generation (RAG) over policy documents stored in Amazon Simple Storage Service (Amazon S3). The Gateway aggregates the capabilities of configured targets into a single unified catalog, presenting them to the agent as one tools/list response rather than acting as a wrapper.
"Enterprises today need a clear way to extend their authentication and authorization controls into the agentic layer, often requiring either broad service account permissions or custom-built auth integrations that add operational overhead."
The guide notes that while the tested patterns utilize Okta and Microsoft Entra ID, the external IdP configurations follow standard OAuth flows and can extend to other SaaS providers. Organizations must validate token claims, scopes, and audience settings for their specific target environment. The reference implementation and sequence diagrams provided in the announcement serve as the baseline for production deployment, emphasizing that token vault management and automatic renewal are handled entirely by AgentCore Identity to minimize agent-side complexity.
Sources
PNEUMETRON EDITORIAL
Pneumetron's pipeline pairs AI-assisted drafting with human editorial review before publishing — our goal is to make staying informed easier, not to replace real reporting.




