OAuth 2.0 Design
Specifies an exact OAuth 2.0 profile: client types, grants incl. PKCE, scopes, tokens, refresh and revocation.
$5
Works with the AI tools you already use
OAuth 2.0 Design
Example session with this skill installed
Design the OAuth 2.0 security profile for our B2B Partner Portal and Mobile App.
- Subject: Identity Platform v3.0, clients: Partner Web SPA (React, public client) and iOS/Android Mobile Apps (public client) accessing Core Banking API (run-id: b2b-portal-auth-001).
- Deciders: InfoSec Board (Lead: Sarah Chen) and Identity Lead (Marcus Vance).
- Authorization Server: Keycloak 24 cluster (FIPS mode, OpenID Connect 1.0 certified).
- Token Lifetime: Access token TTL 15 minutes (JWT signed with ES256, bound to audience https://api.bank.internal/v1); refresh token TTL 7 days.
- Tension: Frontend partner team requested OAuth 2.0 Implicit Grant to avoid backend token exchanges; SecOps strictly forbids Implicit Grant per RFC 8252 and OAuth Security BCP, mandating Authorization Code Grant with PKCE (S256 only) and single-use Refresh Token Rotation with automatic revocation of all descendant tokens upon reuse detection.
- Scopes: Granular read/write scopes (partner:accounts:read, partner:transfers:write, partner:statements:export); maximum refresh token lifetime 30 days absolute.
Write the OAuth profile specification under docs/.
- Read your context and instructions
- Compiled the oauth 2 0
- Generated the UI component
Wrote docs/architecture/tasks/b2b-portal-auth-001/oauth-design/oauth-profile-spec.md. Complete OAuth 2.0 security profile specifying Authorization Code Grant with S256 PKCE, single-use refresh token rotation with breach detection, and ES256 JWT access tokens.
skill: oauth-design
OAuth 2.0 Profile Specification: B2B Partner Portal and Mobile [OAUTH-SEC-001]
Summary
This specification establishes the OAuth 2.0 security profile for Identity Platform v3.0 under run ID b2b-portal-auth-001.
It governs authentication and API authorization for public clients, including the Partner Web SPA and Mobile Apps, accessing the Core Banking API.
The profile rejects the deprecated Implicit Grant and mandates the Authorization Code Grant with mandatory Proof Key for Code Exchange (PKCE), using code_challenge_method=S256 exclusively.
The profile specifies
- 15-minute ES256-signed JWT access tokens
- Strict audience binding
- Single-use Refresh Token Rotation
- Automated refresh-token reuse detection and revocation cascades
- RFC 7009 token revocation
Detailed Description
Public clients cannot securely maintain client credentials. Historical OAuth implementations relied on the Implicit Grant, exposing access tokens in browser history, URI fragments, and HTTP Referer headers.
This profile conforms to the OAuth 2.0 Security Best Current Practice (BCP) and RFC 8252 (OAuth for Native Apps).
Criteria and Weights
| Criterion | Why it matters here | Weight | Source of the weight |
|---|---|---|---|
| Token Leakage Prevention | Public clients run on untrusted user devices; tokens in URI fragments risk interception. | 0.35 | Sarah Chen (SecOps Lead) |
| Credential Replay Defense | Stolen refresh tokens must not grant perpetual access to banking transfer scopes. | 0.30 | Marcus Vance (Identity Lead) |
| Standard Spec Conformance | Architecture must adhere to RFC 7636 (PKCE), RFC 6749, and OAuth 2.0 Security BCP. | 0.20 | Information Security Board |
| Granular Resource Scoping | Limit blast radius by bounding tokens to explicit audience strings and minimal scopes. | 0.15 | Banking API Policy |
Comparison
| Grant / Flow Candidate | Client Type | PKCE Requirement | Token Delivery Seam | Evaluation |
|---|---|---|---|---|
| Implicit Grant (RFC 6749 §4.2) | Public | None | Front-channel URL fragment | Rejected: Deprecated by OAuth Security BCP; vulnerable to token leakage in browser history. |
| Authorization Code + Plain PKCE | Public | code_challenge_method=plain | Back-channel POST | Rejected: Does not provide the required protection against interception of the authorization code. |
| Authorization Code + S256 PKCE + Rotation | Public | code_challenge_method=S256 | Back-channel TLS POST | Selected: Uses mandatory S256 PKCE and refresh-token rotation with reuse detection. |
Result
Authorization Code Flow with PKCE (S256) is selected.
All public client token requests must use back-channel TLS exchanges.
Required Mechanisms
1. Authorization Flow and PKCE Parameters [MC-AF-01]
Authorization Request:
GET /realms/bank/protocol/openid-connect/auth?response_type=code&client_id=partner-web-spa&redirect_uri=https%3A%2F%2Fpartner.bank.com%2Fcallback&scope=openid%20partner%3Aaccounts%3Aread%20partner%3Atransfers%3Awrite&state=c3ab89d412e&code_challenge=E9Melhoa2OwvFrGMTJguCH5rtx64ZnVUq8_D3u5fc2k&code_challenge_method=S256 HTTP/1.1
Host: auth.bank.internal
Invariant: Authorization requests missing code_challenge_method or specifying plain are rejected with HTTP 400 invalid_request.
2. Token Exchange and Verification [MC-TE-01]
Token Request:
POST /realms/bank/protocol/openid-connect/token HTTP/1.1
Host: auth.bank.internal
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code&client_id=partner-web-spa&code=SplxlOBeZQQYbYS6WxSbIA&redirect_uri=https%3A%2F%2Fpartner.bank.com%2Fcallback&code_verifier=dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk
The authorization server computes BASE64URL(SHA256(code_verifier)) and compares the result byte-for-byte with the stored code_challenge.
3. Token Profile and Scopes [MC-TP-01]
Access Token (JWT):
- Algorithm:
ES256(ECDSA using P-256 and SHA-256) - Lifetime: 900 seconds (15 minutes)
Claims Schema:
| Claim | Value |
|---|---|
iss | https://auth.bank.internal/realms/bank |
aud | https://api.bank.internal/v1 |
sub | User ID (UUIDv4) |
client_id | partner-web-spa |
scope | partner:accounts:read partner:transfers:write |
exp | Epoch timestamp (Now + 900s) |
4. Refresh Token Rotation and Breach Detection [MC-RR-01]
Refresh tokens are single-use artifacts with a 7-day sliding TTL and a 30-day absolute ceiling.
Rotation Cycle:
- Client presents
refresh_token_A. - Authorization server invalidates
refresh_token_A. - Authorization server issues
access_token_2andrefresh_token_B.
Breach Detection Cascade:
If an already-invalidated token (refresh_token_A) is presented again, the authorization server treats this as a token-reuse condition:
- Detect the reuse condition.
- Immediately revoke
refresh_token_Band all descendant tokens associated with the session. - Invalidate the active user session.
- Force complete re-authentication.
5. Revocation Endpoint (RFC 7009) [MC-RV-01]
Clients invoke
POST /realms/bank/protocol/openid-connect/revoke HTTP/1.1
Host: auth.bank.internal
Content-Type: application/x-www-form-urlencoded
token={token}&token_type_hint={token_type_hint}
upon user logout.
Invariants and Contracts
INV-OAUTH-01 — Prohibition of Implicit Grant
The Keycloak realm client configuration must have implicitFlowEnabled=false.
Any authorization request with response_type=token is rejected immediately.
INV-OAUTH-02 — Strict S256 PKCE Enforcement
Public clients must supply code_challenge_method=S256.
The authorization server must refuse code_challenge_method=plain or an omitted challenge method.
INV-OAUTH-03 — Audience Restriction
All access tokens emitted must carry
aud=https://api.bank.internal/v1
Core Banking API resource servers must reject access tokens lacking this exact audience claim.
Explicit Unknowns
- G-1: Hardware security module (HSM) key rotation schedule for ES256 signing keys in Keycloak.
- G-2: Native mobile app deep-linking constraints across Android App Links and iOS Universal Links.
Traceability
| Claim | Classification | Source | Freshness |
|---|---|---|---|
| Keycloak 24 cluster in FIPS mode | provided | Intake specification | Current |
| Access token TTL 15 min; Refresh TTL 7 days | provided | Intake specification | Current |
| Mandatory PKCE with S256 | decided | SecOps Policy & INV-OAUTH-02 | 2026-09-15 |
| Implicit grant rejection | decided | Sarah Chen & Marcus Vance | 2026-09-15 |
| Single-use refresh token rotation | provided | Request constraint | Current |
| Max refresh token lifetime 30 days absolute | provided | Request constraint | Current |
Verification
No validator was supplied, so no command was run.
Reviewer self-check against OAuth 2.0 Security BCP contracts:
- PKCE Verification: PASS. Requires
code_challenge_method=S256; plain method forbidden. - Grant Integrity: PASS. Authorization Code flow strictly required; implicit flow disabled.
- Rotation Mechanics: PASS. Single-use rotation with breach revocation cascades specified.
- Token Security: PASS. ES256 cryptographic signature and 15-minute expiration window enforced.
Open Decisions
DEC-OAUTH-01: Sarah Chen to determine whether a step-up MFA challenge is required when requesting scope partner:transfers:write.
Owner: Sarah Chen.
Next Steps
- Marcus Vance configures Keycloak 24 realm clients, disabling implicit flow and enforcing PKCE S256.
- Provide the frontend partner team with reference Authorization Code + PKCE integration library code.
- Configure the Core Banking API gateway JWT validator to enforce ES256 signature validation and
audverification.
oauth-2-0-design.tsx
TSX · React component
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
What it does
This skill maps accepted delegated-authorization use cases and protocol authority into exact client, endpoint, grant, request, token, scope/resource, lifecycle and failure contracts. It keeps OAuth authorization separate from user authentication and resource authorization enforcement.
Use it when
Use when an accepted OAuth deployment needs a bounded profile for exact actors, clients, grants and protected resources.
For example: “Our mobile app ships with a client secret in the binary because that's what the SDK example did. We also allow a wildcard redirect for our staging subdomains.”
What you get
- OAuth2 Architecture Spec
Written as Markdown to <your output folder>/architecture/tasks/<run-id>/oauth-design/.
What it will not do
Do not use for choosing OAuth/provider, OIDC authentication, enterprise IAM/session architecture, API authorization policy, JWT/key design, social-login integration, one callback/middleware implementation or testing.
How it works
- Check the question is delegated authorisation.
- Pick the grant from the client's real characteristics.
- Define the scopes as things a resource server can enforce.
- Fix redirect URIs and PKCE for every public client.
- State token lifetime, refresh behaviour and revocation.
- Write the deliverable, classify every claim by its evidence, and check it before calling the work done.
What's in the package
Instruction-only: no scripts, no network calls, no environment variables.
- LICENSE.txt
- SKILL.md
- agents/openai.yaml
- assets/output-template-task.md
- references/domain-rules.md
- references/operating-rules.md
- references/output-contract.md
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 13 days ago
- Passed all security checks, Safe to install