Teams should use OAuth 2.0 with PKCE for any public client such as SPAs, mobile apps, desktop apps, and CLIs. Legacy flows like Implicit and password-based grants remove too much protection from the exchange path and should only survive in migration plans, not new designs.
Why PKCE changes the OAuth choice for public clients
PKCE changes the decision point because it protects the authorization code exchange itself. Public clients cannot safely keep a client secret, so the security of the flow depends on binding the code to the instance that started the login. That makes PKCE the practical default for browser-based, mobile, desktop, and command-line clients.
Older patterns fail because they assume the client can be trusted to keep static credentials or that the redirect leg is safe enough on its own. In public clients, neither assumption holds. PKCE reduces the value of intercepted authorization codes and narrows the window for code injection or replay during the exchange.
For teams comparing flow families, the real question is whether the client can defend a secret and sustain a stronger back-channel exchange. If it cannot, legacy grants are usually a migration artifact rather than a new-build choice. The modern baseline is authorization code flow with PKCE, as described in the core OAuth specification and current best-current-practice guidance from the IETF: RFC 6749: The OAuth 2.0 Authorization Framework and RFC 9700: Best Current Practice for OAuth 2.0 Security.
When legacy flows still appear in real environments
Legacy flows survive for two main reasons: compatibility and rollout sequencing. Large estates often contain older clients, embedded integrations, or vendor products that were built before PKCE became the expected default. In those cases, the engineering task is usually containment and migration planning, not normalization of the legacy flow as an evergreen option.
The implicit flow is the clearest example of a design that no longer belongs in new work. It returns tokens through a path that exposes them more broadly than the authorization-code-plus-PKCE pattern, which is why modern guidance prefers code flow even for browser apps. Password-based grants are even harder to justify because they collapse the user interaction and credential handling model in a way that weakens separation of duties and raises phishing and reuse risk.
Where teams still need to support older clients, they should treat those flows as exceptions with explicit scope, monitoring, and expiry. The migration target should be a smaller number of standards-based flows, not a broad menu of grant types chosen for convenience.
For identity and token handling details that matter to implementation teams, NHIMG’s OAuth 2.0 and OpenID Connect Guide for Identity Teams is the most direct companion to this decision, and its broader treatment of client types and grant types helps teams separate public-client reality from legacy habits.
How to decide between PKCE and an older grant
Use PKCE whenever the client is public or distributed, which includes SPAs, mobile apps, desktop apps, and CLIs. That is the safest decision even when the application also uses OpenID Connect for sign-in, because PKCE protects the OAuth exchange itself rather than the higher-level identity session.
Choose a legacy flow only when you are constrained by a specific dependency that cannot yet be modernised and you have a documented retirement path. The decision should be driven by client capability, token exposure, and redirect integrity, not by familiarity with the old flow or by the convenience of skipping implementation work.
For teams that need a migration reference, the relevant comparison is not “new versus old” in the abstract. It is whether the client can safely bind the authorization response, avoid static shared secrets, and preserve a verifiable token exchange. When those conditions are not met, PKCE is the safer minimum control.
For deployment and threat-model context, NHIMG’s OAuth 2.0 and OpenID Connect Guide for Identity Teams and MCP Security Guide are useful because they show how OAuth choices affect authorization, token handling, and delegated access in modern client patterns.
Risk and Threat Considerations
The main security risk in legacy flows is token or code interception, followed by replay or misuse in a different client context. That risk is materially worse when the client cannot protect a secret or when tokens are exposed through front-channel behavior that is easy to inspect, log, or redirect.
Failure mechanism: An attacker or malicious intermediary captures the authorization response, code, or token and redeems it before the legitimate client can complete the exchange, or abuses a grant that was never designed to resist public-client compromise.
Impact: The result can be unauthorized account access, session hijack, or persistence through long-lived tokens, especially when older integrations rely on weak redirect handling or overly broad token scopes.
NHIMG’s Microsoft verified publisher OAuth phishing 2022 illustrates how OAuth consent abuse can translate into durable mailbox access, while the IETF security guidance on sender-constrained and proof-of-possession protections shows why code binding matters in practice: RFC 9700: Best Current Practice for OAuth 2.0 Security and RFC 9449: OAuth 2.0 Demonstrating Proof of Possession (DPoP).
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP API Security Top 10 addresses the attack and risk surface, while NIST SP 800-53 Rev 5, OWASP ASVS and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | IA-5 — Authenticator Management | PKCE replaces fragile shared secrets with safer client exchange controls. |
| IA-9 — Service Identification and Authentication | OAuth client authentication for apps and services depends on strong machine-side proof. | |
| Recommendation — Use PKCE and rotate or remove any remaining client secrets supporting legacy grants. Require stronger client authentication for non-public OAuth clients and avoid shared-secret patterns. | ||
| OWASP ASVS | V10 — OAuth and OIDC | The question is directly about selecting secure OAuth flows for modern clients. |
| Recommendation — Prefer authorization code flow with PKCE for public clients and retire implicit and password grants. | ||
| OWASP API Security Top 10 | API2 — Broken Authentication | Weak OAuth flow choices can undermine token issuance and client authentication. |
| Recommendation — Harden token exchange paths and reject legacy flows that weaken authentication assurance. | ||
| CIS Controls v8 | CIS-6 — Access Control Management | Flow selection affects how access is granted and protected across client types. |
| Recommendation — Remove legacy grant exposure and limit OAuth access paths to approved modern flows. | ||
Practitioner Guidance
What to prioritise: Prefer PKCE as the default for any client that cannot safely hold a secret. If a team proposes a legacy grant, ask what compensating control makes the exchange path materially safer, not just simpler.
What to verify: Confirm that the client type, redirect handling, and token exchange path match the intended flow. If the app is public, the burden of proof is on the legacy design.
Common mistake: Treating an older grant as acceptable because it still “works.” Working is not the same as defensible, and in OAuth the exchange path is where that difference matters most.
Practitioner takeaway: If the client cannot keep a secret, choose PKCE and treat older flows as temporary compatibility bridges with a retirement date, not as a design standard.
Related resources from NHI Mgmt Group
- How should security teams choose between OAuth flows for different client types?
- How should security teams choose TOTP over SMS for high-risk authentication flows?
- What are the implications of using OAuth tokens in third-party integrations?
- Why is OAuth token management critical in cloud environments?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on October 7, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org