Poppy-Session header and, once the User has signed in, the access token.
Authlete handles the OAuth parts for you. It recognizes Personal Agents by their URL (CIMD), verifies their signed client assertions (private_key_jwt), binds tokens to their keys (DPoP), and issues and checks tokens. Your servers make the same Authlete API calls as for any other client.
This guide sets up an Authlete service for Poppy and walks through each piece a Company builds, one Authlete API call per step. It uses Stays, Authlete’s reference Company, as the example. For what Poppy is and how to test your Company, see the Poppy overview.
When to use Poppy
- Customers bring their own agents. Personal agents such as Meta’s Muse look for Poppy on the sites they visit. With Poppy, those agents can sign your customers in and act for them, within limits you set.
- You want one way in for every agent. Instead of a separate integration for each agent, you publish one
poppy.jsonfile and any Poppy agent can work with you. - You already use Authlete. Poppy’s sign-in is OAuth. Your Authlete service handles it with a few setting changes.
How the flow works
- The agent reads your
poppy.jsonand your OAuth metadata, and finds your authorization server. - The agent sends an authorization request with its URL as
client_id. Authlete fetches the agent’s metadata and registers it. - The User signs in on your page and approves the scopes, and your server issues an authorization code.
- The agent exchanges the code for an access token, proving its identity with a signed assertion and, optionally, a DPoP proof.
- Your API checks the
Poppy-Sessionheader and the access token on every request.
Discovery
poppy.json and metadata
Agent identity
The client ID is a URL
Sign-in
The User approves scopes
Access token
Bound to the agent’s key
API call
Session header and token
Prerequisites
- An Authlete 3.0.40 or later service and its Service Access Token. To create them, follow First API Call. Use a test service: you will change its settings.
- Two HTTPS hosts: your Company’s domain, such as
stays.poppysandbox.dev, and your authorization server, such asauth.stays.poppysandbox.dev. - To run the cURL commands:
curl,jq, andopenssl.
SERVICE_ID and SERVICE_ACCESS_TOKEN with your values, and us.authlete.com with your service’s cluster.
Set up the SDK
To follow the TypeScript, Go, or Ruby tabs, install the SDK and create a client. The steps reuse this client.- TypeScript
- Go
- Ruby
Get an agent ID
A Personal Agent’s client ID is the URL of its metadata document. This guide uses the Poppy Agent Playground, a public test agent. Open its URL to see the document Authlete will fetch:jwks_uri and signs a client assertion with them (private_key_jwt). This agent doesn’t name its signing algorithm (token_endpoint_auth_signing_alg), and Poppy doesn’t require it. Authlete accepts its assertion when it verifies with one of the agent’s published keys. It also lists the device grant, which you handle with a metadata policy below.
Configure the service
Set the following in Service Settings in the console, or with the Update Service API. The API replaces the whole service, so read the service first and send it back with these fields changed.
Don’t add
DEVICE_CODE just because an agent lists it. Listing it in your metadata tells agents you offer Device Sign-In, which also needs a device authorization endpoint and a verification page (deviceVerificationUri). Add it only when you build Device Sign-In; otherwise every attempt fails with [A222101].
To support Pushed Authorization Requests (PAR), which Poppy agents should use when your metadata lists the endpoint, add a POST /oauth/par endpoint that forwards the request to Authlete’s /pushed_auth_req API, and set its URL in the service. The rest of this guide works the same with or without PAR.
What you build
A Company has two hosts. Each endpoint on the authorization server is a thin wrapper around one Authlete API call.Endpoints you’ll use
Build it
Publish poppy.json
Every agent starts at
https://{your domain}/.well-known/poppy.json. Serve it from your Company’s own domain, over HTTPS, with no sign-in. It names your Company and authorization server, describes each scope in the words Users will see, and lists your APIs.This is Stays’ file, abridged:poppy.json
organization.domainmust equal the host that serves the file.auth.issuermust equal theissuerin your Authlete service.- Hints are optional. Each hint you include needs both
changes(none,reversible, orirreversible) andpersonal_data. - If you also serve older versions, list only those in
supported_versions, not your ownprotocol_version.
The file loads over HTTPS, and
organization.domain matches the host.Publish the protected resource metadata
Agents check the issuer in
poppy.json against your protected resource metadata (RFC 9728). Serve it on your Company’s domain, next to poppy.json. In Poppy, the protected resource is your whole domain, so the file sits at the root with no path after it./.well-known/oauth-protected-resource
resource must be exactly https:// followed by your domain.authorization_servers contains your Authlete service’s issuer.Show the consent page and issue the code
INTERACTION means the request is valid and it is time to ask the User. Your server signs the User in on your own domain and shows a consent page. Name the agent (client.clientName) and show its logo from the logo_uri in its metadata, so the User can recognize it. List every scope you will grant, using the descriptions from your poppy.json; Poppy requires the consent page to list them all. Stays shows “Book a room on your account. Each booking needs your approval.” rather than stays:write. Also show the agent’s domain and a warning such as “Only continue if you asked this agent to do this just now,” and never approve just because the page was opened. Poppy requires these cross-device practices from RFC 10027 (BCP 247), section 2.When the User approves, send the ticket from step 4 and your ID for the User. Authlete returns the redirect URL with the code:action is LOCATION, and responseContent carries a code and an iss that matches your issuer.Process the token request
The agent posts the code to your token endpoint. Unlike a public client, it proves who it is with a client assertion: a JWT it signs with one of the keys at its The form body the agent sends looks like this. Pass it to Authlete as it is:API reference: Process Token Request
jwks_uri (private_key_jwt). Poppy requires the assertion’s aud to be your issuer and its exp to be at most 5 minutes after iat. It may also send a DPoP header, a proof signed with a key it holds, so that the access token is bound to that key.Your server passes the form body to Authlete unchanged. If the request has a DPoP header, also pass it with the HTTP method and the exact public URL of your token endpoint. Authlete checks the code, the PKCE verifier, the assertion against the agent’s published keys, and the DPoP proof.Only the agent holds the keys for the assertion and the DPoP proof, so you can’t make this request yourself with cURL. To run it end to end, use the Poppy Agent Playground, as in Test it.
responseContent is the JSON your server returns to the agent:action is OK. token_type is DPoP when the agent sent a DPoP proof, and Bearer otherwise.Check each request to your API
Every request an agent sends to your API carries a A request with no access token for an operation that needs an account gets
Poppy-Session header. Signed-in requests also carry the access token and, for a DPoP-bound token, a fresh DPoP proof. Your API checks the Session header first, then the token.The Session header. Authlete does not check this header; your API does. It is a JWT signed with a short-lived key, and its poppy_dlg header holds a delegation that one of the agent’s published keys vouches for. Following section 5.3 of the Poppy specification:- Check that
Poppy-Versionis1.0. If it’s missing or a version you don’t support, answer400with{"error": "version_unsupported"}. - Verify the delegation with the agent’s keys from its
jwks_uri, then verify the Session header with the key in the delegation’scnf.jwk. Reject a Session header without apoppy_dlgdelegation, including one signed directly with a key fromjwks_uri. Accept delegations signed withES256orPS384. The delegated key can change between requests, so don’t treat a new one as an error. When you fetch the agent’s metadata and keys, don’t connect to loopback, private, or link-local addresses. - Check
typispoppy-session+jwt,audis your issuer,htmandhtumatch this request’s method and public URL, andiatis recent. - If the request has an access token, check that
athis its hash. - Look up the Session by the agent’s
client_id,sid, and the User ID insub.
400 with {"error": "invalid_session"}.The access token. Pass the token, the scope this operation needs, and for a DPoP-bound token, the DPoP proof with the method and URL. Authlete checks that the token is valid, carries the scope, and is bound to the key that signed the proof:action is OK, subject is the User the agent acts for, and metadataDocumentLocation is the agent’s URL.401 with no error code, and the scope it needs in the WWW-Authenticate challenge. A token without the scope gets 403 with insufficient_scope.API reference: Process Introspection RequestRevoke tokens on sign-out
When the User signs out, the agent revokes every refresh token it holds for your Company at your revocation endpoint. The agent authenticates with a client assertion, as at the token endpoint. Pass the form body to Authlete unchanged:API reference: Process Revocation Request
action is OK. Authlete also answers OK for a token it doesn’t know, as RFC 7009 requires.Test it
Point the Poppy Agent Playground at your Company’s domain. It runs every step on this page against your servers, signs its client assertion with its own keys, and decodes each request under Wire:- In the box at the top, enter your domain and click Discover. This covers steps 1 to 3.
- Under Call an API, pick an operation that needs an account and click Send. Your API should answer
401, and the agent tells you which scope it needs. - Click Sign in to your Company, sign in on your page, and approve. This covers steps 4 to 6.
- Send the same operation again. It should now succeed. This covers step 7.
Troubleshoot
Before you go live
- Decide which agents you accept. Poppy leaves this to the Company. An allowlist accepts only the agents you list, which is the safest choice but turns away agents you haven’t reviewed. Without one, any agent can register, and a metadata policy limits what it can declare. Either way, replace the test-only allowlist with your own decision.
- Sign Users in on your own domain. Run the authorization server and the sign-in pages on hosts Users recognize, such as
auth.andaccount.under your domain. - Require your issuer as the assertion audience. Turn on
clientAssertionAudRestrictedToIssuer, so Authlete rejects client assertions addressed to anything else. - Advertise only what works. Every grant type in your metadata must work, and every scope in
poppy.jsonmust have a description. Hints are optional, but each one must have bothchangesandpersonal_data. - Keep the cache on and development switches off. Leave
cimdAlwaysRetrieved,cimdHttpPermitted, andcimdQueryPermittedoff, and turn onhttpAliasProhibited. - Check the Session header on every request, including signed-out ones.
Known limitation (§4.1): Poppy §4.1 requires each
redirect_uris entry to be on the same domain as client_id (or loopback), a rule the spec files under “stricter than OAuth.” Since Authlete fetches and validates the CIMD, it does RFC 9700 exact-match on redirect_uri but not the §4.1 same-domain check, so a CIMD with client_id and redirect_uris on different domains is accepted today, though a fully conformant Company would reject it. Authlete will consider adding this check as part of introducing a “Poppy profile.”Next steps
- Poppy overview: what Poppy is, what Authlete handles, and how to test your Company.
- CIMD overview: every CIMD setting, including the allowlist and metadata policy.
- Personal Agent Protocol specification