auth.md is how an agent registers with a service that uses Authdog, then gets a token for the scopes you publish. The agent discovers the service from OAuth metadata, calls a registration endpoint, and either presents an identity assertion or waits while a person confirms a 6-digit code.
People still sign in the way they do today. auth.md adds a registration path for agents. It is an open protocol (the spec). Authdog implements discovery, registration, the claim, and token exchange.
This is not Agent Sign-In. Agent Sign-In is an agent signing into your app as itself. auth.md is an agent registering against your API on behalf of a person.
How an agent finds you
The agent starts from a 401 and reads two metadata documents. Both are on the API host (https://api.authdog.com unless your agent_auth.skill URL says otherwise).
- The resource responds
401with aWWW-Authenticate: Bearerheader. - The agent fetches
/.well-known/oauth-protected-resource(RFC 9728) for the resource name, authorization servers, and scopes. - The agent fetches
/.well-known/oauth-authorization-serverand reads theagent_authblock.
| Field | Use it to |
|---|---|
skill |
Fetch the auth.md instructions. Authdog serves them at /agent/auth.md. |
identity_endpoint |
Register. Authdog's path is POST /agent/identity. |
claim_endpoint |
Run the user-code claim. |
identity_types_supported |
anonymous, service_auth, and identity_assertion. |
identity_assertion.assertion_types_supported |
urn:ietf:params:oauth:token-type:id-jag. |
token_endpoint on the same document is where the agent later exchanges an assertion. Authdog's path is POST /oauth2/token.
Three identity types
The registration body sets type. That decides whether a person has to confirm the agent.
type |
When the agent uses it | What you must send | Claim |
|---|---|---|---|
anonymous |
No user yet | { "type": "anonymous" } |
Optional. A code is returned, and pre-claim scopes stay narrow until the person confirms. |
service_auth |
The email comes from a context you trust | login_hint, an email address |
Required. Missing login_hint returns invalid_request. |
identity_assertion |
The agent already holds an ID-JAG | assertion and assertion_type |
Not started. A present ID-JAG finishes registration without a user code. |
Register
curl -X POST https://api.authdog.com/agent/identity \
-H "Content-Type: application/json" \
-d '{"type": "anonymous"}'An anonymous registration looks like this:
{
"registration_id": "agreg_...",
"identity_assertion": "aidn_...",
"claim_token": "aclm_...",
"claim": {
"user_code": "482913",
"verification_uri": "https://auth.authdog.com/claim",
"expires_in": 600
},
"pre_claim_scopes": ["api.read"],
"post_claim_scopes": ["api.read", "api.write", "users.read", "users.write"]
}service_auth returns a claim_token and a claim, and no identity_assertion yet. Add the hint to the verification URL (/claim?hint=ada%40example.com). identity_assertion returns registration_id and identity_assertion only.
Until the claim completes, an anonymous agent can call with the pre-claim scopes (api.read). After the claim, the post-claim scopes apply: api.read, api.write, users.read, and users.write.
The user confirms a code
For anonymous and service_auth, show the person the user_code. They open verification_uri, sign in, and enter the code. The code expires in 10 minutes (expires_in is 600 seconds).
Then complete the claim:
curl -X POST https://api.authdog.com/agent/identity/claim/complete \
-H "Content-Type: application/json" \
-d '{"claim_token": "aclm_...", "user_code": "482913"}'A valid code returns an identity_assertion, a refresh_token, and expires_in of 3600 seconds. A code shorter than 6 characters returns invalid_grant.
Exchange the assertion for an access token
POST /oauth2/token accepts RFC 7523 JWT-bearer only. Pass the identity_assertion you received.
curl -X POST https://api.authdog.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer" \
-d "assertion=aidn_..." \
-d "resource=https://api.authdog.com/"The response is a bearer access token, valid for 3600 seconds. scope defaults to api.read when you omit it. Any other grant_type returns unsupported_grant_type. A missing assertion returns invalid_request.
Revoke
Revoke an access token or a refresh token with RFC 7009. Send token, and token_type_hint of access_token or refresh_token when you know which it is.
curl -X POST https://api.authdog.com/oauth2/revoke \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "token=aat_..." \
-d "token_type_hint=access_token"The endpoint responds 200 when the token is revoked and when it was already invalid.
Related
| Read | To learn how to |
|---|---|
| Agent Sign-In | Let an agent sign into your app as itself |
| Agents | Register, scope, and revoke agents in the console |
| AgentSec | See authentication and access control together |
| MCP authentication | Put OAuth 2.1 in front of an MCP server |
| Sessions and tokens | Validate the tokens your API already accepts |
| Authorization | Decide what the token is allowed to do |
| Audit | Read the trail of registrations and other environment events |