Introduction to Agentic Trust Frameworks
In the evolving landscape of Agentic Commerce, the traditional model of session-based authentication is being replaced by persistent, delegated authority. As part of the Universal Commerce Protocol (UCP), the concept of UCP Identity Linking ensures that an AI agent—whether running on Gemini, via the Model Context Protocol (MCP), or within a merchant’s custom environment—can act with the explicit permission of a human user. This technical guide explores the implementation of OAuth 2.0 flows and identity linking strategies designed to secure these autonomous transactions.
The Identity Linking Workflow
Identity linking in UCP is a multi-step handshake that binds a Google Identity to a Merchant’s internal customer record. This process is essential for ensuring that when an agent initiates a request, the merchant can verify the user’s eligibility, pricing tiers, and loyalty status. The workflow follows a strict Zero-Trust architecture.
The Three-Way Trust Model
The UCP identity model involves three distinct parties: the User (the identity owner), the Agent (the delegated entity, often powered by Gemini), and the Merchant (the service provider). Unlike traditional web apps where the user is the primary actor, the agent acts as a middleman that requires programmatic access. The connection is established via the OAuth 2.0 Authorization Code Flow with Proof Key for Code Exchange (PKCE) to prevent interception during the agentic handoff.
Step-by-Step Handshake
- Initial Trigger: The user interacts with a Gemini-powered agent. The agent identifies the need to perform a transaction through a UCP-compliant merchant.
- Discovery: The agent queries the merchant’s
/.well-known/ucp-configurationendpoint to locate the authorization server. - Redirection & Authentication: The user is prompted to link their Google account. This uses the Google Identity Services (GIS) to provide a seamless login.
- Authorization Code Exchange: Once authenticated, the merchant issues an authorization code which is exchanged by the UCP gateway for an access token and a refresh token.
- Mapping: The merchant’s backend maps the
sub(subject) claim from the Google ID token to the merchant’s internal UUID.
Configuring OAuth 2.0 Scopes for UCP
Granular control over permissions is vital for agentic security. When an agent requests access to a user’s commerce data, it should only hold the minimum necessary scopes to complete the task. Within the UCP framework, we differentiate between discovery scopes and transactional scopes.
| Auth Phase | OAuth / OIDC Standard | UCP Identity Scope | Cryptographic Handshake | Security Enclave | Compliance |
|---|---|---|---|---|---|
| 1. Agent Registration | RFC 7591 Dynamic Registration | ucp:agent:identity |
Ephemeral ECDSA Key Pair | Hardware Keystore | W3C DID |
| 2. Consumer Consent | Auth Code Flow with PKCE | openid profile ucp:mandate |
Hardware Passkey Attestation | Biometric Mobile TPM | FIDO AP2 |
| 3. Token Exchange | RFC 8693 Token Exchange | ucp:checkout:settle |
DPoP Proof-of-Possession | Non-exportable memory | Zero PII |
| 4. Spending Mandate | RFC 7519 JSON Web Token | ucp:spend:limit |
Merchant-bound claim token | Hardware Non-repudiation | EMVCo v3 |
| 5. Continuous Validation | RFC 7662 Token Introspection | ucp:session:active |
Mutual TLS 1.3 ping | Redis Revocation Cache | OAuth 2.1 |
Native vs. Embedded Checkout Paths
The implementation of identity linking varies significantly based on the checkout path. In a Native Checkout scenario, the agent facilitates the entire transaction within the Google ecosystem (e.g., inside the Gemini interface). Here, identity linking is deep; the agent holds the token and passes it to the Merchant via a JSON-RPC call. In an Embedded Checkout path, the agent directs the user to a merchant-hosted micro-frontend. In this case, the identity link is passed as a secure state parameter to ensure the session remains consistent across the handoff.
The Role of MCP in Identity Propagation
The Model Context Protocol (MCP) serves as the transport layer for context between the LLM and the external tools. When implementing identity linking, the MCP server must act as a secure vault for OAuth tokens. Developers should implement a ‘Token-Aware Toolset’ where every tool call made by the LLM is automatically enriched with the Bearer token of the linked user. This prevents the LLM from ever seeing the raw credentials, maintaining a clean separation of concerns.
Token Revocation and Agent Lifecycle Management
The lifecycle of an agent’s authority must be strictly managed to prevent unauthorized long-term access. Unlike human sessions that might last for weeks, agentic tokens often have shorter TTLs (Time-To-Live) but rely on refresh tokens for background tasks like order tracking.
Security and Revocation Triggers
UCP-compliant merchants must implement a robust revocation strategy. If a user unlinks their Google account from the merchant’s settings, a backchannel_logout notification should be sent to the UCP gateway. This immediately invalidates all active access tokens held by the agent. Furthermore, the UCP protocol supports Risk Signals. If Google’s security systems detect suspicious activity on the user’s account, a signal is broadcasted to the merchant to pause all agentic commerce activities associated with that identity.
Handling Token Expiration in Gemini
When Gemini attempts a tool call and receives a 401 Unauthorized response, the MCP implementation must be capable of a silent refresh. If the refresh token is also expired, the agent must gracefully handle the failure by asking the user to re-authenticate: “I need you to re-verify your merchant account to complete this purchase.” This ensures the user remains in the loop for high-stakes security events.
Conclusion: The Future of Verified Agentic Commerce
By implementing a rigorous OAuth 2.0 and identity linking strategy, developers enable a world where AI agents can be trusted with financial autonomy. Leveraging the Universal Commerce Protocol alongside Google’s identity infrastructure creates a framework where every ‘Buy’ command is backed by a verified, authorized, and revocable link. As we move toward more complex agentic behaviors, these security fundamentals will remain the cornerstone of user trust in the Google AI ecosystem.
OAuth 2.0 & UCP Identity Linking FAQ
Why is PKCE mandatory for all UCP agent identity linking flows?
Proof Key for Code Exchange (PKCE, RFC 7636) prevents authorization code interception on untrusted client runtimes, ensuring only the specific agent instance that initiated authorization can exchange the code for access tokens.
How does DPoP prevent token theft if an AI agent’s network traffic is intercepted?
Demonstrating Proof-of-Possession (DPoP, RFC 9449) cryptographically binds access tokens to a private key in the agent’s secure enclave. Intercepted tokens cannot be replayed without a matching signed proof.
Can consumers revoke an agent’s delegated spending mandate without resetting their password?
Yes. UCP uses granular OAuth 2.0 scopes, allowing instant revocation of delegated spending mandates without changing main account credentials.
Related UCP Guides & Specifications
- AP2 vs. OAuth 2.0 for B2B Agent Authorization — comparing cryptographic payment mandates with delegated OAuth scopes.
- CTO Guide #17: Token Lifecycle & Key Rotation — securing long-lived agent credentials.
- CTO Guide #28: Zero-Trust Agent Gateways — enforcing per-request policy checks at the edge.
- CTO Guide #29: Federated Identity for Shopping Agents — cross-merchant session and consent verification.
- CTO Guide #34: Vendor Selection for Agent Identity — evaluating IAM providers for UCP/AP2 readiness.

Leave a Reply