← Back
AWS ML Blog

Secure OAuth patterns for Snowflake Cortex AI through Amazon Bedrock AgentCore

•26 min read•
#agents#bedrock
Level:Advanced
For:AI Engineers
✦TL;DR

This article details three OAuth authentication patterns for Snowflake Cortex AI when accessed via Amazon Bedrock AgentCore, covering Snowflake‑native OAuth (per‑user Authorization Code flow), three‑legged OAuth with a corporate IdP (Authorization Code flow), and two‑legged OAuth with a third‑party IdP (client‑credentials flow). It explains how AgentCore Identity acts as a credential broker, invoking GetWorkloadAccessTokenForJWT to obtain a workload JWT and then GetResourceOauth2Token to fetch the appropriate OAuth token for the Snowflake MCP server. Engineers can choose the pattern that matches their enterprise’s user‑attribution and automation needs, with on‑behalf‑of (OBO) token exchange available for unattended workloads.

⚡ Key Takeaways

  • Tested three OAuth configurations: Snowflake OAuth (per‑user, no external IdP), three‑legged OAuth with corporate SSO, and two‑legged OAuth with a shared service user.
  • AgentCore Identity uses the GetWorkloadAccessTokenForJWT API to acquire a JWT and then calls GetResourceOauth2Token to retrieve the OAuth token for the MCP target.
  • Grant types supported are authorization_code (for Snowflake OAuth and three‑legged OAuth) and client_credentials (for two‑legged OAuth), affecting whether user interaction is required.
  • Integration point: Amazon Bedrock AgentCore Gateway aggregates Snowflake MCP tools (Cortex Search, Cortex Analyst) into a single catalog presented to the agent.
  • Limitation: Two‑legged OAuth provides no per‑user attribution; it is suited only for machine‑to‑machine workloads.
💡 Why It Matters

Selecting the appropriate OAuth flow lets engineers enforce fine‑grained, per‑user access controls or streamlined service‑account access while leveraging Bedrock AgentCore’s built‑in token management, reducing custom auth code and operational overhead.

✅ Practical Steps

  1. Call GetWorkloadAccessTokenForJWT from AgentCore Identity to obtain a workload JWT for inbound authentication.
  2. Use the obtained JWT to invoke GetResourceOauth2Token against the configured OAuth provider (Snowflake, corporate IdP, or third‑party IdP) to receive the access token for Snowflake MCP.
  3. Configure the AgentCore Gateway to present the fetched OAuth token when invoking Snowflake Cortex Search or Cortex Analyst tools.

Want the full story? Read the original article.

Read on AWS ML Blog ↗

More like this

Introducing Gemini 4 Neon

Google DeepMind•#llm

DaisyRose-27B: Pushing the Frontier of Post-Training Efficiency

Hugging Face Blog•#llm

Mathematical proof, powered by AI. And no hallucinations!

Amazon Science•#agents

AI’s GPU focus meets a CPU reality check at Dell and AMD

SiliconANGLE AI•#agents

EXPLORE AI NEWS

Daily hand-picked stories on LLMs, RAG, agents and production AI — curated for engineers who ship.

BROWSE NEWS

GET THE WEEKLY DIGEST

Join engineers getting the Monday signal-over-noise AI breakdown. No spam, unsubscribe anytime.

LEARN AI ENGINEERING

Curated courses, research papers, repos and tutorials built for engineers leveling up in AI.

START LEARNING