Skip to main content
A Poppy Company publishes discovery files, signs Users in on its own pages, and checks two things on every request: the 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.json file 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

  1. The agent reads your poppy.json and your OAuth metadata, and finds your authorization server.
  2. The agent sends an authorization request with its URL as client_id. Authlete fetches the agent’s metadata and registers it.
  3. The User signs in on your page and approves the scopes, and your server issues an authorization code.
  4. The agent exchanges the code for an access token, proving its identity with a signed assertion and, optionally, a DPoP proof.
  5. Your API checks the Poppy-Session header 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 as auth.stays.poppysandbox.dev.
  • To run the cURL commands: curl, jq, and openssl.
In the commands below, replace 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.

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:
Unlike most CIMD clients, a Personal Agent is not a public client. It publishes its keys at 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

1

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.domain must equal the host that serves the file.
  • auth.issuer must equal the issuer in your Authlete service.
  • Hints are optional. Each hint you include needs both changes (none, reversible, or irreversible) and personal_data.
  • If you also serve older versions, list only those in supported_versions, not your own protocol_version.
The file loads over HTTPS, and organization.domain matches the host.
2

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.
3

Serve the authorization server metadata

Next, the agent reads /.well-known/oauth-authorization-server on your authorization server. Your server does not build this document. It returns what Authlete generates from your service settings.Poppy also requires protected_resources to list your Company, which completes the two-way check. Authlete includes it when you set protectedResources in Configure the service.
issuer matches poppy.json, client_id_metadata_document_supported is true, grant_types_supported includes refresh_token, and protected_resources includes your domain.
API reference: Get Service Configuration
4

Process the authorization request

When a task needs an account, the agent sends the User’s browser to your authorization endpoint. Poppy calls this Direct Sign-In. The request carries the agent’s URL as client_id, the scopes it wants, a PKCE challenge, and prompt=consent, which Poppy requires so the User approves the agent every time. If the agent pushed the request first (PAR), the query string carries only client_id and request_uri. Either way, your server passes the query string to Authlete unchanged.Authlete sees a URL it does not know, so it fetches the agent’s document, checks it, registers the agent, and then checks the rest of the request.To try it, create a PKCE pair as the agent would:
action is INTERACTION, and client.clientSource is METADATA_DOCUMENT. The agent now appears on the service’s Clients page.
API reference: Process Authorization Request
6

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 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.
The form body the agent sends looks like this. Pass it to Authlete as it is:
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.
API reference: Process Token Request
7

Check each request to your API

Every request an agent sends to your API carries a 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:
  1. Check that Poppy-Version is 1.0. If it’s missing or a version you don’t support, answer 400 with {"error": "version_unsupported"}.
  2. Verify the delegation with the agent’s keys from its jwks_uri, then verify the Session header with the key in the delegation’s cnf.jwk. Reject a Session header without a poppy_dlg delegation, including one signed directly with a key from jwks_uri. Accept delegations signed with ES256 or PS384. 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.
  3. Check typ is poppy-session+jwt, aud is your issuer, htm and htu match this request’s method and public URL, and iat is recent.
  4. If the request has an access token, check that ath is its hash.
  5. Look up the Session by the agent’s client_id, sid, and the User ID in sub.
If any check in steps 2 to 5 fails, answer 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.
A request with no access token for an operation that needs an account gets 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 Request
8

Revoke 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:
action is OK. Authlete also answers OK for a token it doesn’t know, as RFC 7009 requires.
API reference: Process Revocation Request

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:
  1. In the box at the top, enter your domain and click Discover. This covers steps 1 to 3.
  2. 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.
  3. Click Sign in to your Company, sign in on your page, and approve. This covers steps 4 to 6.
  4. Send the same operation again. It should now succeed. This covers step 7.
Then repeat the test with an agent you didn’t write, such as the Poppy Simulator. See See Poppy in action in the overview, including a checklist of what each tool should find.

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. and account. 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.json must have a description. Hints are optional, but each one must have both changes and personal_data.
  • Keep the cache on and development switches off. Leave cimdAlwaysRetrieved, cimdHttpPermitted, and cimdQueryPermitted off, and turn on httpAliasProhibited.
  • 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