name: design-an-authentication-flow
description: Designs token authentication with issuance, renewal, revocation, and failure behavior. Use when the user needs an API to authenticate clients safely.
domain: api-design
tags: [authentication, oauth, token-security]
triggers: ["api authentication flow", "design token authentication", "specify an oauth login flow"]
Designs token authentication with issuance, renewal, revocation, and failure behavior
Purpose
Designs token authentication with issuance, renewal, revocation, and failure behavior.
When to use
Use when the user needs an API to authenticate clients safely.
When NOT to use
Do not use this for internal function signatures; use software-engineering instead.
Inputs required
- The consumers and what they need
- The resources and the operations involved
- The versioning, auth and rate-limit policy
Procedure
- Define the supported principals, credential types, and trust boundaries.
- Describe token issuance, expiry, refresh, rotation, and revocation.
- Specify the transport header and the claims each client must present.
- Define authentication failures with stable error codes and no credential leakage.
- Require TLS and document safe client-side token storage.
Output contract
A documented contract with endpoints, payloads, error shapes and versioning rules.
Validation checklist
Safety notes
Never change an existing response shape without a version bump and a migration note.
Related skills
design-an-authorization-model
design-an-error-response-format
design-an-event-streaming-api
1---2name: design-an-authentication-flow3description: Designs token authentication with issuance, renewal, revocation, and failure behavior. Use when the user needs an API to authenticate clients safely.4---5---6name: design-an-authentication-flow7description: Designs token authentication with issuance, renewal, revocation, and failure behavior. Use when the user needs an API to authenticate clients safely.8domain: api-design9tags: [authentication, oauth, token-security]10triggers: ["api authentication flow", "design token authentication", "specify an oauth login flow"]11---1213# Designs token authentication with issuance, renewal, revocation, and failure behavior1415## Purpose1617Designs token authentication with issuance, renewal, revocation, and failure behavior.1819## When to use2021Use when the user needs an API to authenticate clients safely.2223## When NOT to use2425Do not use this for internal function signatures; use software-engineering instead.2627## Inputs required2829- The consumers and what they need30- The resources and the operations involved31- The versioning, auth and rate-limit policy3233## Procedure34351. Define the supported principals, credential types, and trust boundaries.362. Describe token issuance, expiry, refresh, rotation, and revocation.373. Specify the transport header and the claims each client must present.384. Define authentication failures with stable error codes and no credential leakage.395. Require TLS and document safe client-side token storage.4041## Output contract4243A documented contract with endpoints, payloads, error shapes and versioning rules.4445## Validation checklist4647- [ ] Every error has a stable machine-readable code48- [ ] Pagination, filtering and idempotency are defined49- [ ] The contract is versioned and backward compatible5051## Safety notes5253Never change an existing response shape without a version bump and a migration note.5455## Related skills5657- `design-an-authorization-model`58- `design-an-error-response-format`59- `design-an-event-streaming-api`