Skip to main content

OAuth 2.0, OAuth 2.1 & OpenID Connect

Learning objectives
  • Walk through authorization code + PKCE, client credentials, device, refresh and token-exchange grants, and name the attack each parameter defeats
  • Choose between JWT and opaque access tokens, rotate signing keys, and decide where tokens are validated
  • Design sender-constrained tokens (DPoP, mTLS) and PAR/RAR payment consents to the FAPI 2.0 profile
  • Use OpenID Connect correctly: ID token vs access token, nonce, discovery, back-channel logout and CIBA
  • Map SBV Circular 64/2024/TT-NHNN onto an OAuth/FAPI design for a Vietnamese bank's Open API

TL;DR​

  • OAuth is delegated authorization; OIDC adds authentication. Access tokens go to APIs, ID tokens stay with the client.
  • One user-facing flow: authorization code + PKCE, with state, nonce, iss and exact redirect URIs. Implicit and password grants are gone.
  • OAuth 2.1 is still an IETF draft (as of October 2026). It consolidates RFC 9700 (Security BCP, January 2025), so building to RFC 9700 puts you on 2.1 in practice.
  • Bearer tokens are cash. For money movement, sender-constrain them (mTLS, DPoP), restrict their audience, keep them short-lived, and rotate or bind refresh tokens.
  • Open banking means FAPI 2.0: PAR, PKCE, private_key_jwt or mTLS, and bound tokens. RAR puts the exact amount and payee into the consent.
  • Vietnam: Circular 64/2024/TT-NHNN has been in force since 1 March 2025. Banks with existing third-party APIs must comply before 1 March 2027.

Why it matters​

Token breaches are design mistakes, not broken cryptography: a client secret inside a mobile app, a payments API that accepts a token minted for the loyalty API, a stolen refresh token that works for 90 days, a fintech consent that says "make payments" instead of "pay VND 2,500,000 to Shop A once".

Circular 64 now requires Vietnamese banks to offer consent-based Open APIs to third parties. Bank interviews ask how you would build that authorization server; e-commerce interviews ask how checkout would pay through it. Security for Architects covers the basics. This page covers each flow end to end, the threat behind each parameter, and the open-banking profile.

Core concepts​

Roles and channels​

The resource owner (account holder) delegates to a client; the authorization server (AS) issues tokens, and the resource server (RS) is the API. A confidential client can keep a key (a fintech backend, a BFF); a public client cannot (a mobile app, an SPA). The front channel is browser redirects, visible to history, extensions and logs; the back channel is direct server-to-server TLS. Put almost nothing in the front channel: a single-use code or a request_uri reference.

Authorization code + PKCE, end to end​

Web banking through a backend-for-frontend (BFF):

MechanismAttack it stops
PKCE (code_challenge S256, code_verifier)A stolen or injected code redeemed by someone else
state bound to the sessionLogin CSRF (you land in the attacker's account); enforced PKCE also covers this
nonce in the ID tokenReplay of an ID token into another login
iss in the response (RFC 9207)Mix-up when a client trusts several authorization servers
Exact redirect-URI matchingCodes leaking through open redirects
Single-use code, ≤60 sReplay of a code taken from logs or history

Client credentials​

No user, just a workload authenticating at /token, so authentication strength is what matters. client_secret_basic is a shared secret that leaks and is painful to rotate. With private_key_jwt (an RFC 7523 assertion), the client signs a short JWT and the AS stores only a public key. tls_client_auth (RFC 8705) uses the client certificate itself. Request an audience-restricted token (resource, RFC 8707), cache it until near expiry, and give each service its own client.

Device authorization grant (RFC 8628)​

For TVs, POS terminals and kiosks: the device shows a user_code, then polls /token (authorization_pending, slow_down) while the user approves on a phone. The weakness is phishing: an attacker starts a flow and sends the victim the code ("enter this to claim your voucher"). Keep codes short-lived, describe the device on the approval screen, and never grant payment scopes this way.

Refresh tokens: rotation and reuse detection​

RFC 9700 requires refresh tokens of public clients to be sender-constrained or rotated. With rotation, each refresh returns a new refresh token and invalidates the old one, and the AS remembers the family. If an old token comes back, the AS can't tell attacker from client, so it revokes the whole family and forces a new login.

  • False positives: parallel refreshes, or a response lost on a bad mobile network, look like reuse. Serialise refreshes in the client and allow a grace window of a few seconds in which the old token returns the same new token.
  • Bound tokens don't need rotation: FAPI 2.0 tells servers not to rotate except in extraordinary cases.
  • Revoke the family on logout, password change, device removal and consent withdrawal.

Token exchange (RFC 8693)​

Checkout calls payments on behalf of the shopper. Forwarding the user's token requires an audience that covers every downstream service; client credentials lose the user. With token exchange, checkout sends the user's token as subject_token (grant_type=urn:ietf:params:oauth:grant-type:token-exchange, audience=payments) and receives a narrower token whose act claim names checkout as the actor. Each hop gets the right audience and an audit trail, and the AS decides who may exchange what. Inside one trust domain, the IETF Transaction Tokens draft (as of 2026) proposes a lighter token minted at the edge.

Why implicit and password grants are gone​

The implicit grant returned access tokens in the URL fragment, where history, referrers and extensions see them, with no client authentication or binding. CORS and PKCE removed its reason to exist. The password grant hands the user's password to the client and can't support MFA or passkeys. RFC 9700 says clients SHOULD NOT use implicit and MUST NOT use the password grant, and that includes your own first-party app.

OAuth 2.1 and RFC 9700​

RFC 9700 (BCP 240, January 2025) is today's security baseline:

  • Match redirect URIs exactly; allow no open redirectors.
  • PKCE (S256) is required for public clients and recommended for confidential ones. The AS rejects a code_verifier when no challenge was sent (downgrade).
  • No implicit grant, and never the password grant.
  • Use iss (RFC 9207) against mix-up when you talk to several authorization servers.
  • Sender-constrain access tokens; bind or rotate public-client refresh tokens.
  • Audience-restrict tokens and keep them least-privilege; resource servers reject tokens not meant for them.
  • Prefer asymmetric client authentication, publish AS metadata (RFC 8414), and allow no CORS on the authorization endpoint.

OAuth 2.1 merges RFC 6749 and RFC 6750 with PKCE, the native-apps BCP (RFC 8252), the browser-apps BCP and these rules. It also drops bearer tokens in query strings. Status (as of October 2026): Internet-Draft draft-ietf-oauth-v2-1-16 (September 2026), not yet submitted to the IESG. "OAuth 2.1 support" in a product means RFC 9700 behaviour; don't call 2.1 an RFC in an interview.

Access tokens: JWT or opaque​

JWT access tokens (RFC 9068) carry iss, sub, aud, exp, iat, jti and client_id, plus the header typ: at+jwt. Checking typ stops an ID token from the same issuer passing as an access token. Resource servers validate locally against cached JWKS. Opaque tokens are handles resolved through introspection (RFC 7662): revocation is instant and no claims leak, but the AS sits on the hot path unless you cache. Revocation (RFC 7009) is immediate for opaque tokens; for JWTs the lifetime is your revocation SLA unless you push a jti or sid denylist. The phantom-token pattern combines both: outside clients get opaque tokens, and the gateway introspects them and forwards a short-lived internal JWT.

JWKS rotation without an outage:

  1. Publish the new key and keep signing with the old one.
  2. Wait at least the longest JWKS cache TTL.
  3. Switch signing to the new key.
  4. Remove the old key once its last token has expired.

Resource servers cache the JWKS, refresh it in the background, re-fetch it (rate-limited) on an unknown kid, and never follow jku or x5u. In Go, github.com/MicahParks/keyfunc/v3 gives golang-jwt such a cache; combine it with the verifier in Security for Architects and add the typ check.

Where to validate. The gateway checks signature, iss, exp and coarse scope, and applies per-client quotas. The service validates again, because anything that reaches the pod can forge headers. It checks its own aud and the operation's scope, then whether sub owns the object and the consent covers it. See Proxies, Load Balancers & API Gateways.

Sender-constrained tokens: mTLS and DPoP​

  • mTLS-bound tokens (RFC 8705): the cnf claim holds x5t#S256, the client certificate's thumbprint, and the RS compares it with the certificate on the connection. Natural for B2B partners; harder when TLS terminates at a load balancer. See TLS & HTTPS.
  • DPoP (RFC 9449): each request carries a DPoP header, a JWT signed by the client's key with htm, htu, iat, a unique jti and, at APIs, ath (the access-token hash). The token carries cnf.jkt. Being application-layer, it suits mobile apps and SPAs. Servers can demand a DPoP-Nonce and keep a jti replay cache.

DPoP stops token exfiltration, not malicious script already in your page, which can still ask a non-extractable key to sign. One more reason banking web apps use a BFF.

PAR, JAR and RAR: payment consents​

  • PAR (RFC 9126): the client POSTs the authorization request over the authenticated back channel and gets a short-lived request_uri. The redirect carries only client_id and request_uri.
  • JAR (RFC 9101): the request is a signed JWT, for integrity and non-repudiation.
  • RAR (RFC 9396): authorization_details replaces vague scopes. A payment_initiation entry carries amount, currency and creditor. The consent screen shows it, the token is bound to it, and the API refuses anything else. That is dynamic linking.

A FAPI 2.0 payment initiation:

A single-use token doesn't help when the fintech retries after a timeout, so the payment call still needs Idempotency & Exactly-Once handling.

FAPI 2.0​

FAPI is the OpenID Foundation's hardened OAuth profile. The FAPI 2.0 Security Profile became Final in February 2025 and FAPI 2.0 Message Signing in September 2025 (as of 2026). The Security Profile requires:

  • the authorization code flow with PAR and PKCE S256, and iss in the response
  • confidential clients using mTLS or private_key_jwt (no shared secrets)
  • only sender-constrained access tokens (mTLS or DPoP)
  • codes valid at most 60 s, request_uri under 600 s, reused codes rejected
  • PS256, ES256 or EdDSA signatures and TLS 1.2 or later

Message Signing adds non-repudiation: signed authorization requests, signed authorization responses (JARM), signed introspection responses and signed ID tokens. Schemes pick FAPI for its formal attacker model and the OpenID Foundation's conformance tests and certification, which let a bank and hundreds of fintechs interoperate without bilateral reviews. The UK and Brazil built on FAPI 1.0 Advanced; a 2025 OpenID Foundation paper says Australia's CDR, Saudi Arabia and the UAE have committed to FAPI 2.0 (verify current status).

OpenID Connect​

ID tokenAccess token
AudienceThe client (client_id)The API
ConsumerThe client, once, at loginThe API, on every call
SaysWho logged in, when, how (auth_time, acr, amr), nonceWhat the client may do (scope, authorization_details)
FormatAlways a JWTJWT (typ: at+jwt) or opaque

The classic mistake is sending the ID token to an API because it is a JWT with the user's ID. It names no API audience, carries no authorization and is often long-lived. Reject it on aud and typ.

  • Discovery: /.well-known/openid-configuration lists endpoints, algorithms and jwks_uri. Pin the issuer in config and check that the document's issuer matches.
  • UserInfo returns profile claims (openid profile email phone) for an access token; keep PII out of access tokens.
  • Step-up: acr_values and max_age request stronger or fresher authentication. With RFC 9470 an API can answer insufficient_user_authentication, for example before a new payee is added.
  • Logout: iframe-based Session Management and Front-Channel Logout rely on third-party cookies, which browsers increasingly block. Back-Channel Logout is reliable: the OP POSTs a signed logout_token (sub and/or sid, an events claim, no nonce) to each RP, which deletes those sessions. Store sid at login so you can find them.

CIBA: decoupled approval​

CIBA (Client-Initiated Backchannel Authentication, Core 1.0 Final in 2021) lets a client that is not in front of the user request authentication on the user's own device. A call-centre agent needs the customer's approval to raise a card limit:

Tokens are delivered by poll (shown), ping (the AS notifies, then the client calls /token) or push; the FAPI CIBA profile requires signed requests and forbids push. Because the agent reads the binding_message aloud and the app shows it, the customer approves this request, not a parallel one. Log the agent ID with the action. Circular 64's "decoupled flow" APIs follow the same pattern.

Architecture patterns​

Browser apps. RFC 10017 (Browser-Based Applications BCP, August 2026) ranks three patterns: a BFF keeps tokens server-side and gives the browser an HttpOnly cookie; a token-mediating backend hands access tokens to the browser; a pure browser client is a public client with PKCE. Banking and anything with personal data should use a BFF.

Native apps (RFC 8252). Use the system browser (ASWebAuthenticationSession, Android Custom Tabs), never an embedded WebView that can read the password, plus claimed HTTPS redirects (universal links, app links), PKCE and no client secret. Ideally bind tokens with DPoP using a hardware-backed key.

Service to service. Three layers that combine:

  • Workload identity: mTLS with SPIFFE IDs from a mesh or SPIRE proves which workload is calling, with no secrets.
  • Client credentials add scopes and audience across trust domains. An IETF draft (as of 2026) standardises SPIFFE SVIDs as client credentials.
  • Token exchange carries the user's context across hops.

Scopes vs fine-grained authorization. Scopes say what the client may ask for (accounts:read), not which accounts. Object-level decisions stay in the service or a policy engine. Marketplace rules such as "seller staff may refund their own shop's orders" fit relationship-based models (Zanzibar-style ReBAC); see authorization models.

Consent management. In open banking, a consent is a resource with a lifecycle: AwaitingAuthorisation, Authorised, then Consumed (single payment), Revoked or Expired. Tokens reference the consent ID, and every call checks that it is still Authorised and covers this account. Withdrawal revokes the refresh token at once; access tokens must also stop working quickly, which argues for introspection on account-information APIs.

Trade-offs​

OptionStrengthsWeaknessesChoose when
JWT access tokensLocal validation, AS off the hot pathRevocation waits for expiry; claims readableInternal and first-party APIs, short lifetimes
Opaque + introspectionInstant revocation, nothing leakedAS on every call (cache it), extra latencyPartner-facing and high-risk APIs
mTLS-bound tokensProven, strong, fits partner PKICertificate lifecycle; TLS termination complicates checksB2B and open banking
DPoPApp-layer, works for mobile and SPAsProof per request, replay cache, newerMobile banking, public clients
private_key_jwtNo shared secret, rotation via JWKSKey and clock managementFintech clients, FAPI
Token exchangePer-hop audience, act audit trailAS round trip per hop, policy upkeepUser context across services

In practice​

Lifetimes (rough; tune to risk):

ArtefactTypical lifetime
Authorization code≤60 s, single use (FAPI 2.0 maximum)
Access token5–15 min; payment tokens single use
Refresh tokenHours to days for apps; up to consent expiry for open-banking account access
ID tokenMinutes; consumed once at login

The AS is a tier-0 dependency. If it is down, nobody logs in and nothing refreshes. Run it multi-zone, rate-limit /token per client, cache JWKS and introspection results, and alert on spikes in invalid_grant (refresh reuse). Whether self-hosted (Keycloak, Ory Hydra) or managed (Okta/Auth0, Ping, Authlete), check FAPI certification and which of PAR, DPoP, RAR and CIBA your version supports.

Go: BFF login with PKCE. This uses golang.org/x/oauth2 (PKCE helpers since v0.13) and github.com/coreos/go-oidc/v3 for discovery and ID-token checks. State, verifier and nonce stay server-side; the browser only gets a session cookie.

package bff

import (
"context"
"crypto/rand"
"net/http"
"time"

"github.com/coreos/go-oidc/v3/oidc"
"golang.org/x/oauth2"
)

type pendingLogin struct{ Verifier, Nonce string }

// Both stores are server-side (e.g. Redis). Take is get-and-delete, so a state works once.
type LoginStore interface {
Put(ctx context.Context, state string, p pendingLogin, ttl time.Duration) error
Take(ctx context.Context, state string) (pendingLogin, error)
}

type SessionStore interface {
// Create keeps the tokens server-side and indexes the ID token's sid for back-channel logout.
Create(ctx context.Context, idt *oidc.IDToken, tok *oauth2.Token) (string, error)
}

type BFF struct {
Issuer string
OAuth oauth2.Config // Endpoint from oidc.NewProvider(ctx, issuer).Endpoint()
IDTokens *oidc.IDTokenVerifier // provider.Verifier(&oidc.Config{ClientID: ...})
Logins LoginStore
Sessions SessionStore
}

func (b *BFF) Login(w http.ResponseWriter, r *http.Request) {
state, nonce := rand.Text(), rand.Text() // Go 1.24+, 128+ bits each
verifier := oauth2.GenerateVerifier()
p := pendingLogin{Verifier: verifier, Nonce: nonce}
if err := b.Logins.Put(r.Context(), state, p, 5*time.Minute); err != nil {
http.Error(w, "try again later", http.StatusServiceUnavailable)
return
}
url := b.OAuth.AuthCodeURL(state, oauth2.S256ChallengeOption(verifier), oidc.Nonce(nonce))
http.Redirect(w, r, url, http.StatusFound)
}

func (b *BFF) Callback(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query()
// Unknown or reused state: CSRF or replay. Foreign iss: mix-up attack (RFC 9207).
p, err := b.Logins.Take(r.Context(), q.Get("state"))
if iss := q.Get("iss"); err != nil || (iss != "" && iss != b.Issuer) {
http.Error(w, "invalid login response", http.StatusBadRequest)
return
}
tok, err := b.OAuth.Exchange(r.Context(), q.Get("code"), oauth2.VerifierOption(p.Verifier))
if err != nil {
http.Error(w, "login failed", http.StatusBadGateway)
return
}
rawID, _ := tok.Extra("id_token").(string)
idt, err := b.IDTokens.Verify(r.Context(), rawID) // signature, iss, aud = client_id, exp
if err != nil || idt.Nonce != p.Nonce {
http.Error(w, "login failed", http.StatusUnauthorized)
return
}
sessionID, err := b.Sessions.Create(r.Context(), idt, tok) // tokens never reach the browser
if err != nil {
http.Error(w, "try again later", http.StatusServiceUnavailable)
return
}
http.SetCookie(w, &http.Cookie{
Name: "__Host-session", Value: sessionID, Path: "/",
Secure: true, HttpOnly: true, SameSite: http.SameSiteLaxMode,
})
http.Redirect(w, r, "/", http.StatusSeeOther)
}

Vietnam context: Circular 64/2024/TT-NHNN​

Verify current regulations

Dates and articles come from the circular's text (English translation). Appendix details come from a public draft and industry summaries. Check the official appendices before relying on them.

What the circular says (issued 31 December 2024, effective 1 March 2025):

  • Scope: commercial banks, cooperative banks and foreign bank branches. A third party is an organisation or another bank with an Open API contract; a customer is an individual.
  • Basic Open APIs (Article 6): interest and exchange rates; customer information (Customer Consent and Retrieval, Get / Refresh / Revoke Access Token, account list, account details, transaction history); payment initiation and e-wallet top-up and withdrawal, with Redirect Flow and Decoupled Flow authentication APIs. Only banks and payment intermediaries may receive payment-initiation APIs.
  • Bank duties (Articles 9 and 11): systems at security level 3 or higher; tools to view and withdraw consent; access to customer information limited to 180 days after consent unless agreed otherwise; limits on automated queries; monitoring for abnormal access; usage logs kept 3 months, backups 1 year; sandbox and API list published on the bank's website.
  • Third parties (Article 12) must let customers view and withdraw consent online and report incidents to the bank.
  • Transition (Article 15): banks already sharing data by API had to send the SBV an inventory and plan before 1 July 2025 and must comply before 1 March 2027.

Appendix 02 (technical standards). Industry summaries of the final text list OAuth 2.0, OIDC, TLS 1.2+, JWS/JWE and level-3 security. The July 2024 public draft specified authorization code + PKCE, an OIDC hybrid flow for payments, client credentials and detached JWS request signatures, with 60 s codes, client-credentials tokens up to 5 minutes, account-information tokens up to 60 minutes, single-use payment tokens, and refresh tokens for account information only. Treat these as indicative. The draft also uses a client_secret, which FAPI 2.0 would not allow.

Choices that go beyond the minimum and are easy to defend:

  • FAPI 2.0 as the profile: certifiable and already known to vendors and fintechs.
  • private_key_jwt or mTLS instead of client secrets.
  • RAR, so the biometric approval (see Compliance) is tied to the exact amount and payee.
  • Introspection on account-information APIs, so withdrawal takes effect at once.
  • Per-client gateway quotas for the automated-query limit (see Rate Limiting).
  • An immutable audit store for consent events.

Common pitfalls​

  • APIs accepting ID tokens. Symptom: any client that logged a user in can call your APIs.
  • Wildcard redirect URIs. Symptom: codes delivered to attacker-chosen paths via an open redirect.
  • Client secrets in mobile apps or SPAs. Symptom: the secret is pulled from the APK within a day.
  • Unbound, long-lived refresh tokens. Symptom: a stolen phone keeps working after the password change.
  • Reuse detection without a grace window. Symptom: random logouts on flaky networks after a release.
  • Scopes as the only authorization. Symptom: accounts:read reads anyone's account (BOLA).
  • Careless JWKS rotation. Symptom: every API rejects every token for one cache TTL.
  • Revoking only refresh tokens on consent withdrawal. Symptom: a withdrawn consent still reads transactions for an hour.

Interview angle​

  • Prompts: "Design login for a mobile banking app." "How would a fintech initiate payments from our customers' accounts?" "How do services pass the user's identity?" "How do you revoke a JWT?"
  • A strong answer names the flow and the attack each parameter stops, sender-constrains tokens for money movement, uses PAR and RAR for consent, keeps object-level authorization in services, and states lifetimes with a revocation story.
  • Follow-ups: "The AS is down: what still works?" "A refresh token was reused: now what?" "How do you rotate signing keys?" "DPoP or mTLS for the app?"
  • Red flags: the password grant for the first-party app; tokens in localStorage for internet banking; "the gateway handles security"; one client secret shared by many services; calling OAuth 2.1 a published RFC.

Self-check​

1. What do PKCE, state, nonce and iss each defend against?

PKCE binds the code to the client instance that started the flow, so a stolen or injected code can't be redeemed. state, bound to the session, stops login CSRF (enforced PKCE does too). nonce ties the ID token to this login. iss (RFC 9207) stops mix-up attacks across several authorization servers.

2. Why must an API reject an ID token, and which checks enforce it?

An ID token is addressed to the client (aud = client_id) and describes a login, not a grant of access. Accepting it lets any client that logged a user in call the API. The API requires its own audience in aud and, for JWT access tokens, typ: at+jwt (RFC 9068).

3. A customer's phone is stolen, and your APIs use 15-minute JWTs. What happens, and how do you cut off faster?

Revoking the refresh token blocks new access tokens, but the current one stays valid for up to 15 minutes wherever it is validated locally. To cut off faster, introspect on payment APIs, push an sid/jti denylist to the gateway, and sender-constrain tokens so a copy is useless elsewhere.

4. Explain refresh-token rotation with reuse detection, and its false positive.

Each refresh returns a new refresh token and invalidates the old one; the AS tracks the family. If an old token comes back, someone is replaying it, so the AS revokes the family and forces login. Parallel refreshes or a lost response look like reuse, so serialise refreshes in the client and allow a short grace window.

5. DPoP or mTLS-bound tokens: when do you choose each?

mTLS (RFC 8705) suits B2B partners that already run PKI: strong and proven, but certificate lifecycle is heavy and TLS termination complicates the check. DPoP (RFC 9449) uses a client-generated key at the HTTP layer, which suits mobile apps and SPAs, at the cost of a proof per request and a replay cache. FAPI 2.0 accepts either.

6. Scenario: a fintech initiates payments at a Vietnamese bank. Map Circular 64 duties to OAuth/FAPI mechanisms.

Confirm the fintech is a bank or payment intermediary and register it as a confidential client (private_key_jwt or mTLS). Capture consent with PAR + RAR, approved in the bank app with biometrics or a decoupled flow, and issue single-use, sender-constrained tokens tied to it. The consent service handles the 180-day limit and withdrawal, gateway quotas limit automated queries, and logs are kept 3 months online and 1 year in backup.

7. Design the call-centre approval with CIBA. What stops the wrong request being approved?

The tool sends a signed backchannel request with login_hint, scope and binding_message; the customer's app shows the message and the exact change, and the customer approves with biometrics while the tool polls /token. The binding message, read aloud and shown in the app, ties the approval to this request. The agent never holds the customer's credentials, and the agent ID is logged.

🧠 Flashcards0/10 learned · 0 retries

Exercise​

  1. Run Keycloak or Ory Hydra in Docker. Register a BFF client, a fintech client using private_key_jwt, and an API. Enable PAR and DPoP if your version supports them.
  2. Implement the BFF above and an API middleware (golang-jwt/v5 + keyfunc/v3) enforcing an algorithm allowlist, iss, aud, exp, typ: at+jwt and scope, plus GET /accounts/{id} with an ownership check.
  3. Write negative tests: an ID token sent to the API, wrong aud, alg: none, HS256 signed with the public key, an expired token, an unknown state, a foreign iss.
  4. Enable refresh rotation, replay an old refresh token, and confirm the family is revoked. Add a grace window and show that parallel refreshes no longer log the user out.
  5. Write a one-page ADR on JWT vs opaque tokens for Circular 64 account-information APIs.

Done when: every negative test fails closed, reuse revokes the family, rotating the AS signing key under a running request loop causes zero failures, and the ADR states how fast consent withdrawal takes effect.

Further reading​

Finished this page?

Do the self-check first. Marking it complete schedules spaced reviews (1, 3, 7, 14, 30… days).