Start by writing the question this work must answer. For this task, collect Client type, registered redirect URIs, authorization codes, PKCE verifier and challenge, state binding, scopes and token storage. A small representative sample is more useful than a large export nobody can interpret. Note the date range, source and any recent changes so later comparisons are honest.
- Name the decision and owner
- Collect a representative sample
- Record assumptions and recent changes
The next action is to Use exact registered redirect URIs; require PKCE for public clients and appropriate confidential clients; bind state to the initiating session; keep tokens out of URLs and choose storage appropriate to the client and threat model. Work from the underlying cause where possible instead of applying a cosmetic fix to each symptom. Keep a short change log with the page, campaign, component or workflow affected so the team can roll back or investigate later.
- Prioritize the highest-impact cause
- Test in a safe environment when available
- Publish one clearly documented change
Test mismatched redirect and state, code replay, token exposure and recovery paths against current provider guidance. Validation should reflect the original question and include the user path, not only a dashboard metric. If the evidence is inconclusive, record that outcome and choose a narrower follow-up rather than overstating success.
- Re-test the affected path
- Compare against the recorded baseline
- Decide the next step from evidence
Use Authorization Code Flow and protect the authorization response against injection and cross-site request forgery. Bind state to the user's browser and authorization transaction when relying on it; validate it once and reject unexpected or replayed values. OpenID Connect clients must generate and verify nonce where applicable. PKCE can provide transaction binding when correctly supported and enforced by the authorization server; do not assume a client-only check is sufficient.
- Use a single-use state value and compare it with the initiating session
- Bind and validate OIDC nonce when the flow uses it
- Reject unsolicited, mismatched and replayed authorization responses
Public clients must use PKCE under RFC 9700; confidential clients are also advised to use it. Generate a high-entropy verifier for each authorization request, send its S256 challenge, and verify the same transaction's verifier during code exchange. Do not use the plain method where S256 is available. Confirm that the authorization server enforces verifier checks and rejects an invalid or missing verifier rather than treating PKCE as decorative client metadata.
- Create a fresh verifier for each authorization transaction
- Send code_challenge_method=S256 and the derived challenge
- Test that an incorrect verifier causes token exchange to fail
Register and compare redirect URIs exactly, following the applicable client profile. Do not accept untrusted wildcard hosts, attacker-controlled return parameters or redirects that can forward authorization responses elsewhere. Native applications have defined loopback redirect exceptions; those are not a general exemption for web clients. An authorization code returned to the wrong endpoint can be intercepted or injected into another session.
- Reject unregistered scheme, host, path and query variants
- Test encoded delimiters, alternate hosts and open redirect routes
- Apply only the documented native-app loopback exception where relevant
Avoid the resource-owner password credentials grant; it exposes user credentials to the client. Do not use implicit token delivery where an authorization-code-based flow is available. Keep client secrets out of browser and native public-client code. Store tokens with controls appropriate to the platform, minimize scopes and lifetime, and prevent access tokens from appearing in URLs, logs or analytics. Resource servers should validate issuer, signature, expiry and intended audience according to the token profile.
- Use authorization code with PKCE for interactive public clients
- Keep tokens out of URLs, browser logs and client-visible secrets
- Validate token issuer, expiry, scope and audience at the resource server
For public clients, refresh tokens need sender-constraining or rotation with reuse detection; confidential-client refresh tokens must remain restricted to the designated client. A concrete test is to exchange a refresh token, reuse the previous token, and verify the server detects replay and applies its documented revocation response. Also test wrong state, wrong PKCE verifier, altered redirect URI, expired code and audience mismatch. Record expected rejection behavior without placing live tokens in reports.
- Test rotation or sender-constraining behavior for the client type
- Confirm replay and invalid-code requests are rejected
- Capture sanitized evidence and resolve findings with the authorization-server owner