Secure OAuth 2.0 and OpenID Connect integration depends on more than choosing an SDK. This checklist helps developers and IT administrators review authorization flows, redirect handling, token storage, scopes, refresh tokens, logout, and operational controls—then repeat the review as applications, providers, browsers, and libraries change.
Overview
OAuth 2.0 is an authorization framework: it lets an application obtain limited access to a resource without handling the user’s password. OpenID Connect (OIDC) adds an identity layer so the application can authenticate the user and receive identity claims. In a typical sign-in flow, the application redirects the user to an identity provider, receives an authorization response, exchanges a code for tokens, validates the response, and creates its own application session.
The safest default for browser-based applications, mobile apps, and other public clients is generally the authorization code flow with Proof Key for Code Exchange (PKCE). Confidential server-side applications also need strong client authentication and careful token handling. Avoid treating an access token as proof of identity, accepting unsigned or incorrectly validated tokens, or placing long-lived credentials in locations that browser scripts can read.
Use this article as a recurring review document. For the storage and recovery design behind a secure credential vault, see Secure Credential Vault Architecture. For token claims and key rotation, pair this checklist with the JWT Security Review Checklist.
What to track
1. Flow selection and protocol settings
- Use authorization code with PKCE unless a documented architecture review establishes a different requirement.
- Generate a high-entropy, single-use code verifier for each authorization request. Send only the derived challenge to the authorization endpoint, and keep the verifier until the code exchange completes.
- Use OIDC only when identity is required, and request the appropriate OIDC scope and response parameters for the provider’s supported flow.
- Record the issuer, authorization endpoint, token endpoint, supported signing algorithms, key-discovery location, and token lifetimes used by each provider.
Do not copy protocol values from one provider to another without checking the provider’s current discovery document and integration guidance. SDK defaults can change, and a default suitable for a confidential web application may not be suitable for a mobile or single-page application.
2. Redirect URI, state, and nonce controls
- Register exact redirect URIs for each environment. Avoid wildcard redirects, open redirects, and user-controlled redirect parameters.
- Create a fresh, unpredictable
statevalue for every authorization request and verify it before processing the callback. Bind it to the user’s browser session or transaction. - When using OIDC, create and validate a fresh
nonceto reduce the risk of replaying an identity response in the wrong session. - Reject callbacks with a missing, expired, reused, or mismatched state, nonce, code, issuer, or redirect URI.
Keep callback processing narrow. The endpoint should exchange the expected code, validate the resulting response, establish the application session, and then redirect to a safe internal destination. It should not accept arbitrary destinations or expose raw authorization responses in logs.
3. Token validation and storage
Validate tokens for their intended purpose rather than merely decoding them. A JWT decoder can help inspect a token during development, but decoding is not verification. Check the signature using trusted keys, the expected issuer and audience, the token type or use where applicable, expiration and time-related claims, and any required identity claims. Apply an explicit algorithm allowlist instead of accepting the algorithm named by an untrusted token without policy checks.
Store tokens according to the client’s threat model:
- Prefer a server-managed session for browser applications. Keep provider access and refresh tokens on the server when the architecture permits it.
- Protect cookies with Secure, HttpOnly, and an appropriate SameSite setting. Scope the cookie narrowly and avoid placing session identifiers in URLs.
- For mobile and desktop applications, use the operating system’s protected credential storage rather than ordinary files, preferences, or logs.
- Never place access tokens, refresh tokens, client secrets, authorization codes, or code verifiers in analytics events, error reports, support tickets, or source control.
A secure credential vault can centralize server-side secrets and provider credentials, but it does not remove the need for least privilege, access reviews, key rotation, recovery planning, and audit records. The quarterly credential vault access review provides a useful companion control.
4. Scopes, refresh tokens, and session lifetime
- Request the smallest scopes needed for the feature. Separate sign-in scopes from API access scopes where possible.
- Map each scope to a business capability and document which service can use it. Do not grant broad administrative scopes to a general-purpose client.
- Keep application sessions and provider token lifetimes intentional. A long application session should not automatically imply an indefinitely valid provider credential.
- Use refresh-token rotation or an equivalent replay-detection control when supported by the provider and client architecture.
- Revoke or invalidate tokens during account disablement, suspected compromise, client removal, and other defined security events.
When refresh-token rotation is enabled, track the active token family and respond predictably to reuse detection. A reuse event should trigger investigation and session invalidation according to the organization’s incident process, rather than being silently ignored.
5. Errors, logout, and observability
Handle authorization errors without revealing provider details or tokens to the end user. Distinguish user cancellation, denied consent, expired codes, invalid clients, unavailable providers, and local validation failures in internal telemetry. Redact authorization codes, tokens, personal claims, and client secrets from logs.
Logout should clear the application session and local token material. If the provider supports an end-session mechanism, validate its return destination and decide how local and provider sessions should interact. Test logout in more than one browser context; a local logout does not necessarily terminate every provider session.
Track useful security signals such as failed code exchanges, state or nonce mismatches, redirect errors, token validation failures, refresh-token reuse, unexpected issuer changes, and unusual scope requests. Alert thresholds should reflect the application’s normal traffic and be reviewed when that traffic changes.
Cadence and checkpoints
Review the integration at least quarterly for production applications, and perform a focused review whenever a provider, SDK, browser behavior, authentication flow, or token-storage design changes. A practical schedule is:
- Monthly: inspect authentication errors, redirect failures, validation failures, refresh-token events, and unexpected scope or issuer changes.
- Quarterly: review redirect URI registrations, client inventory, scopes, vault access, cookie settings, logout behavior, secret exposure controls, and incident runbooks.
- Before every release: test the authorization callback, PKCE exchange, session creation, token expiry, refresh behavior, denied consent, provider outage, and logout path.
- After dependency or provider changes: compare SDK defaults and discovery metadata with the approved configuration. Re-run security and regression tests before broad rollout.
- After an incident or penetration test: preserve relevant evidence, rotate affected credentials, retest the complete flow, and update the checklist with the new failure mode.
Keep an integration register with the application owner, provider, environments, client type, redirect URIs, scopes, token storage location, vault path or secret reference, last review date, and next checkpoint. This turns an informal sign-in dependency into an accountable security control.
How to interpret changes
Not every change indicates an attack. A rise in callback errors may follow a legitimate redirect URI update; more token validation failures may reflect a provider key rotation, clock drift, or an incorrect issuer configuration. Interpret the signal alongside deployments, provider notices, traffic patterns, and recent changes to browser or SDK behavior.
Prioritize changes that weaken boundaries or increase the impact of a stolen credential:
- A new wildcard or loosely matched redirect URI is a high-priority configuration concern.
- A scope increase should have a named feature owner and a documented reason.
- Tokens appearing in client logs, URLs, analytics, or error reports require immediate containment and review.
- Repeated state, nonce, code, or refresh-token reuse signals should be investigated even when users report no visible problem.
- An issuer, audience, signing algorithm, or key-source change must be verified against trusted provider documentation before production acceptance.
Use a simple decision record for material changes: what changed, why it changed, which clients are affected, what tests were run, who approved it, and when the configuration will be reviewed again. This is especially important when identity data and credentials are stored in a shared cloud environment.
When to revisit
Schedule the next review now rather than relying on memory. Revisit this checklist monthly for operational signals and quarterly for access, configuration, and storage controls. Bring the review forward when adding a provider, changing client type, introducing a new redirect URI, expanding scopes, altering session or cookie behavior, rotating keys, migrating a credential vault, or responding to a suspected token leak.
For the next checkpoint, take five concrete actions:
- Export the current client and provider configuration, then compare it with the approved integration register.
- Run a test authorization using PKCE and confirm state, nonce, issuer, audience, expiry, and signature validation.
- Inspect logs and telemetry for tokens, codes, personal claims, or secrets that should have been redacted.
- Test refresh, expiry, revocation, logout, denied consent, and provider outage behavior using a non-production account.
- Record findings, assign owners and due dates, and update this checklist when the application or provider changes.
OAuth 2.0 and OpenID Connect integrations remain safer when protocol settings, browser behavior, SDK defaults, and credential-vault access are treated as living configuration—not one-time implementation decisions.