Prerequisites
- Configure your UCP resource server and add your UCP scopes.
- Set your UCP resource server as the tenant default audience.
- Create or use a connection where your shoppers’ accounts live: an Auth0 database connection or an enterprise connection to your existing identity provider. If the agent platform is a third-party application, you must promote the connection to the domain level.
Register the agent platform
Model the agent platform as an application in Auth0. It can be a first-party or a third-party application. Create it manually, or, if the agent platform supports it, through its Client ID Metadata Document (CIMD).- Navigate to Dashboard > Applications > Applications and select Create Application.
- Select the application type that matches the agent platform’s client type. Choose Regular Web Application for a confidential client, or Native or Single Page Web Application for a public client. Use the redirect URI provided by the agent platform, and for a confidential client, its client credentials.
- For an agent platform you don’t own, such as Gemini, create a third-party application. Toggle on This application is owned by a third party. Enable stricter security controls. In the Management API, set
is_first_partytofalseandthird_party_security_mode: strict.
If you register a third-party application, it’s subject to enhanced security controls and require additional configuration. Applications registered using CIMD are automatically third-party applications in strict mode. To learn more, read Configure Third-Party Applications.
Authorize the agent platform to call your UCP server
Create a client grant between the application and your UCP resource server, and grant the UCP scopes you want to expose.- Navigate to Dashboard > Applications > APIs and select your UCP resource server.
- Select the Application Access tab.
- Find the agent platform’s application, authorize it, and select the scopes to grant.
Authorization code flow
- The agent platform reads your
scopes_supportedmetadata and shows its own consent screen. - The agent platform redirects the shopper to your tenant’s
/authorizeendpoint with ascopeparameter. Public clients also send a PKCE code challenge. - The shopper signs in or signs up through Universal Login and, for third-party applications, approves access on the consent screen.
- Auth0 redirects back with an authorization code.
- The agent platform exchanges the code for an access token at
/oauth/token. Confidential clients authenticate with their client credentials. Public clients send the PKCE code verifier.
audience parameter, Auth0 issues the token for your tenant default audience.
Use UCP server to call first-party APIs
If you already have an API that provides your commerce functionality, and you’re adding UCP as a new way to interact with it, model them as two separate resource servers in Auth0:- Your UCP resource server, which agent platforms call with the access token from the authorization flow.
- Your existing API, which your UCP server calls on the shopper’s behalf.
act claim.
Configure OBO token exchange
Follow the standard OBO configuration, using your UCP resource server as the incoming token’s audience:- Create a Custom API client linked to your UCP resource server. Set
resource_server_identifierto your UCP resource server’s identifier. - Enable On-Behalf-Of Token Exchange on the Custom API client.
- Create a user-delegated client grant between the Custom API client and your existing API, and grant the scopes your UCP server needs.
Exchange the shopper’s token
When your UCP server receives a request, validate the access token, then exchange it for a token for your existing API. Make aPOST request to the /oauth/token endpoint:
audience to your existing API’s identifier. To learn more, read Perform OBO token exchange.
Cache the exchanged token until it expires instead of exchanging for every request.