Skip to contentSkip to navigationSkip to topbar
Page tools
Useful for sharing or LLM
Accelerate development with AI

On this page
Looking for more inspiration?Visit the

How Agent Identity works


(new)

Private Beta

Agent Identity is available as a Private Beta product, and the information contained in this document is subject to change. You acknowledge and agree that your use of Agent Identity is subject to the terms of the Services in Private Beta(link takes you to an external page). Some features are not yet implemented and others may change before the product is declared as Generally Available. Private Beta products are not covered by the Twilio Support Terms or Twilio Service Level Agreement.

Agent Identity acts as an OAuth 2.1 and OpenID Connect authorization server for your application. This page explains the actors involved, how authentication is delegated back to your system, and how tokens flow through the system.


Key concepts

key-concepts page anchor
  • Resource owner: the end user who owns the data and grants access to it.
  • Client: the application requesting access on the user's behalf, such as an AI agent or an MCP server.
  • Authorization server: the Twilio Agent Identity service. It authenticates the user through your system, records their consent, and issues tokens to the client.
  • Resource server: your platform, with its existing auth system. It validates the access token and returns protected data if the token is valid and carries the required permissions.
  • Trusted Auth Token (TaT): a JWT your existing system signs to tell Agent Identity who the user is and what they're allowed to grant. This is how authentication is delegated back to you.

User authentication is delegated to your platform

user-authentication-is-delegated-to-your-platform page anchor

Agent Identity doesn't manage your users' credentials or sessions. Your authentication system stays in control and interfaces with Agent Identity using Trusted Auth Tokens.

The TaT flow is a lightweight single sign-on (SSO) profile. Your system authenticates the user however it does today, then signs a short-lived JWT (the Trusted Auth Token) that contains context on who the user is and what scopes they can delegate to an agent. The user's browser delivers that token to Agent Identity through a form-post redirect.

Because authentication is delegated this way, you keep full control of the login experience and Twilio's authorization servers don't receive sensitive information like passwords.

For the token schema and step-by-step flow, see Issue Trusted Auth Tokens.


The following sequence describes a complete OAuth authorization code grant, which is the primary flow for agents acting on a user's behalf.

  1. The client (for example, an AI agent) redirects the user to the Agent Identity authorization endpoint with its client_id, a redirect_uri, response_type=code, and the scopes it wants.
  2. If the user isn't authenticated, Agent Identity redirects them to the Trusted Auth Token flow. Your system authenticates the user and returns a signed TaT.
  3. Agent Identity validates the TaT and starts a short-lived session for the user.
  4. If the request needs consent (required for third-party clients; first-party clients skip consent unless specific conditions apply), Agent Identity serves a hosted consent screen that lists the requested permissions and basic information about the client.
  5. Upon user approval, Agent Identity redirects the user back to the client with a one-time authorization code.
  6. The client exchanges the authorization code for an access token at the token endpoint. It can also receive an ID token and, if it requested the offline_access scope, a refresh token.
  7. To access data or take an action, the AI agent calls your resource server, passing the access token in the Authorization header.
  8. Your resource server validates the token signature against the public keys at the Agent Identity JWKS endpoint, then allows the client access.
(information)

Info

First-party clients that you own are trusted by default and skip the consent screen. Third-party clients always require consent. For the full rules, see Client types and consent.


Tokens Agent Identity issues

tokens-agent-identity-issues page anchor

Agent Identity issues three kinds of tokens. All are configurable for lifetime in the Console.

  • Access token: a JWT following the JWT Profile for OAuth 2.1 Access Tokens (RFC 9068(link takes you to an external page)). Your resource server validates it locally using the published public keys. Access tokens are stateless, so they can't be revoked before they expire. Keep their lifetime short.
  • ID token: a JWT following the OpenID Connect Core ID Token format. Agent Identity returns an ID token to any client granted the built-in openid scope.
  • Refresh token: an opaque string returned when a client requests the built-in offline_access scope. A client exchanges a refresh token for a new access token. Refresh tokens can be revoked.

For token schemas and endpoint details, see the Agent Identity API.


Agent Identity runs on a subdomain that you control, such as auth.example.com, configured with a DNS CNAME record. Serving the flow from your own domain improves security and gives users a consistent, branded experience. You configure this domain in the Twilio Console.