How Agent Identity works
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. 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.
- 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.
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.
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). 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
openidscope. - Refresh token: an opaque string returned when a client requests the built-in
offline_accessscope. 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.
Every client has two properties that determine how it behaves.
- Ownership: first-party clients are ones you own and are trusted by default. Third-party clients are built by others and always require user consent.
- Confidentiality: confidential clients can store a secret. Public clients can't.
Combining these gives four client types.
| Client type | Consent | Secret | Notes |
|---|---|---|---|
| First-party confidential | Not required by default | Yes | Trusted; can also use the client credentials grant. |
| First-party public | Not required by default | No | Must use PKCE. |
| Third-party confidential | Required | Yes | External server-based app. |
| Third-party public | Required | No | External native or CLI app; must use PKCE; refresh tokens rotate. |
After a user consents to a third-party client, later flows skip the consent screen unless the requested scopes exceed the existing grant or one of the always-require-consent conditions fires.
Some conditions force a consent screen regardless of client type or prior consent:
- The request includes
prompt=consent. - The request includes authorization details (Rich Authorization Requests).
- The
redirect_uriuses a non-HTTPS scheme, such as a custom scheme. - The
redirect_uriuses plain HTTP (non-HTTPS). - The
redirect_uriuses a loopback address such as127.0.0.1. - A third-party client requests the
offline_accessscope.