Use this OAuth 2.0 and OpenID Connect integration checklist to choose an appropriate flow, configure redirect URIs and scopes, handle tokens safely, and diagnose authorization failures without exposing live credentials. It is designed for API and web application integrations that need a repeatable review before development, release, or an environment change.
Overview
OAuth 2.0 is an authorization framework: it lets an application obtain limited access to a protected resource on behalf of a user or service. OpenID Connect (OIDC) adds an identity layer, allowing an application to verify who authenticated and receive standardized identity claims.
Keep these responsibilities separate during design. An access token answers, “May this client call this resource?” An ID token answers, “Who authenticated, and what identity claims were issued?” An ID token should not normally be sent to an API as an access token. The resource server should validate access tokens according to the authorization server’s documented requirements.
Before implementation, document five decisions:
- Which application type is being integrated: server-side web app, single-page application, native app, machine-to-machine service, or API?
- Which authorization server issues tokens, and which resource server accepts them?
- Is the application authenticating a user, authorizing a client, or doing both?
- Which redirect URIs, scopes, audiences, and claims are required?
- Where will tokens be stored, transmitted, revoked, and monitored?
Prefer standards-based configuration over copying settings from an unrelated application. Provider defaults and administrative terminology vary, so treat the identity provider’s current documentation as the final reference for issuer URLs, endpoints, supported grant types, token formats, and client authentication methods.
Checklist by scenario
Server-side web application
Use the OAuth authorization code flow for a confidential server-side application, with the authorization server’s recommended protection against authorization-code interception. Register exact redirect URIs, keep the client secret on the server, and exchange the authorization code through a back channel. The server should establish its own session after validating the returned response rather than placing long-lived tokens in browser-readable page data.
- Register each environment separately where practical.
- Use HTTPS for production redirect URIs.
- Generate and verify a request correlation value to prevent cross-site request forgery.
- Validate the authorization response before exchanging the code.
- Keep refresh tokens and client credentials out of templates, logs, analytics payloads, and browser storage.
Single-page application
A browser application cannot reliably keep a client secret confidential. Use the authorization code flow with the browser-oriented proof mechanism supported by the provider, and configure the exact application redirect URI. Keep the requested scope set narrow. Consider the consequences of token storage: browser storage can increase exposure if a script injection occurs, while in-memory handling can require users to authenticate again after a page reload.
- Do not embed a client secret in JavaScript bundles or environment variables shipped to the browser.
- Use a carefully reviewed redirect route rather than a broad wildcard.
- Limit access-token lifetime and permissions to what the user experience needs.
- Define a recovery path for expired sessions and failed refresh attempts.
Native or desktop application
Native applications should use an external user agent, such as the system browser, rather than collecting passwords directly. Register platform-appropriate redirect handling and protect the authorization response. Treat installed application code as observable by the user; a static client secret is not a reliable proof of confidentiality.
Machine-to-machine API access
For a service calling another service without a user present, use the provider’s client-authenticated service flow when supported. Create a distinct client identity for each workload or trust boundary instead of sharing one credential across environments. Restrict scopes and audience values, and make rotation and emergency revocation operational tasks rather than one-time setup steps.
| Scenario | Primary design focus | Credential guidance |
|---|---|---|
| Server-side web app | User authorization and server session | Keep client credentials and tokens server-side |
| Single-page app | Browser exposure and token lifecycle | Do not rely on a browser-held client secret |
| Native app | External browser and redirect handling | Assume distributed app code is inspectable |
| Service-to-service | Workload identity and least privilege | Use separate, rotatable credentials per workload |
API resource server
Document the API’s expected issuer, audience, signing algorithms, scopes, and token transport method. Validate the token on every protected request according to the authorization server’s published metadata and key-rotation model. Reject missing, malformed, expired, incorrectly issued, or insufficiently scoped tokens with responses that help legitimate clients recover without disclosing sensitive validation details.
What to double-check
Environment setup
- Issuer and discovery URLs point to the intended environment.
- Redirect URIs match exactly, including scheme, host, port, path, and relevant trailing slash behavior.
- Development, staging, and production clients are not accidentally interchangeable.
- Allowed origins, logout URIs, and API audiences are explicitly configured.
- Scopes are named and documented by purpose, with administrative approval for sensitive access.
Token-handling workflow
- Send the user or service to the authorization endpoint with the required state, scope, redirect URI, and proof parameters.
- Verify the returned state and authorization response before continuing.
- Exchange the authorization code at the token endpoint using the required client authentication.
- Validate the returned token data and associate it with the correct issuer, client, user, and audience.
- Send access tokens only over protected connections and only to the intended resource server.
- Refresh, rotate, revoke, or discard tokens according to the provider’s documented behavior.
Never paste live access tokens, refresh tokens, client secrets, authorization codes, or signed identity tokens into browser-based debugging utilities, tickets, chat, or source control. If inspection is necessary, use synthetic data or redact the sensitive portions first. Review storage and rotation practices alongside your broader secrets management workflow.
Security review template
Record the following before approval: application type; authorization server and issuer; resource servers and audiences; selected flow; redirect URIs; requested scopes; token storage location; access-token and refresh-token handling; logout behavior; key and credential rotation owner; monitoring events; incident revocation procedure; and test evidence for expired, revoked, malformed, and insufficiently scoped tokens.
Common mistakes
- Using an implicit-style browser pattern for a new application. Reassess the flow against current provider and standards guidance instead of inheriting a legacy implementation.
- Using a wildcard redirect URI. An overly broad callback can allow an attacker to redirect authorization results to an unintended location.
- Treating scopes as roles. Scopes express delegated access; application authorization may also require server-side roles, tenant checks, or resource ownership checks.
- Accepting any valid-looking JWT. Signature validity alone does not establish the correct issuer, audience, algorithm, expiry, or permissions.
- Logging token values during troubleshooting. Log request identifiers, endpoint names, status categories, and safe metadata instead.
- Assuming logout revokes every token. Browser session termination, token revocation, refresh-token invalidation, and provider logout can be separate operations.
- Sharing one client across all environments. Environment-specific identities make access review, rotation, and incident containment more manageable.
For API integrations, pair identity checks with contract tests so changes to authentication requirements are detected before release. The OpenAPI contract testing guide provides a useful workflow for that broader compatibility review.
When to revisit
Run this checklist before the first production release, when adding a new client or API, and whenever an environment, redirect URI, scope, audience, or identity provider changes. Revisit it during access reviews and before seasonal planning cycles if those cycles introduce new workloads, domains, teams, or integration partners.
Also review the integration after a provider changes its endpoint, key, token, consent, client-authentication, or default configuration guidance. Standards and provider documentation evolve; avoid assuming that an old sample remains appropriate for a new application.
Make the review actionable by assigning an owner and retaining a small evidence set: the registered configuration, approved scopes, sanitized test results, rotation date, and unresolved exceptions. Test at minimum an expired token, a wrong audience, a missing scope, an invalid redirect, a failed code exchange, and a revoked credential. If any test depends on a live secret, replace it with a controlled test credential and remove sensitive values from logs afterward. This turns an OAuth 2.0 integration checklist into a repeatable release and access-review control rather than a document consulted only after authorization fails.