Allow it only where a real workflow depends on it and the devices involved cannot use stronger methods. For most users, the safer default is to block the flow, because the protocol’s convenience also creates a clean handoff path for attacker-initiated sessions.
When device code flow belongs, and when it does not
device code flow is an exception path, not a general-purpose sign-in method. It fits situations where the user must authenticate on a separate device, such as a TV, kiosk, command-line session, or similarly constrained device. Organisations should approve it only for those workflows and only when stronger methods are impractical on the target device.
The decision should be tied to a documented business need, not convenience for enrollment, support or legacy compatibility. If users already have a browser-capable device or can use phishing-resistant authentication, device code flow usually adds avoidable exposure without creating a new security capability.
One useful test is whether the workflow still makes sense if the sign-in handoff is removed. If the answer is no, that is a strong signal that the flow is serving as a compatibility bridge rather than a necessary control. In that case, prefer a stronger method and redesign the workflow instead of normalising the exception.
What changes in the security decision when the device cannot do stronger auth
The main security issue is not the flow itself, but the trust model it creates. A separate device enters the authentication step, which means the user must verify the right session, on the right screen, at the right time. That makes the process more usable for constrained devices, but it also makes it easier for an attacker to insert a fraudulent prompt, relay a code, or steer the user into authorising the wrong session.
That is why device code flow should be treated as a controlled fallback with a narrow audience. It is most defensible when the target device cannot present a browser-based sign-in or support a stronger authenticator, and when the user population is small enough that the workflow can be monitored and explained clearly.
For teams that need a broader view of the protocol trade-offs, OAuth 2.0 and OpenID Connect Guide for Identity Teams is the right background on grant types and when each flow is meant to be used. For the practical security question of whether the user experience is strong enough against phishing and session theft, Phishing-Resistant MFA Guide helps frame why stronger methods are preferred wherever the device can support them.
How to govern the allowance decision in practice
Decide by workflow class, device capability and account sensitivity, not by user preference. A flow that is acceptable for a low-risk kiosk or operational appliance may be a poor choice for privileged administrators, finance users or high-value support accounts. The higher the privilege or the more sensitive the application, the less tolerant you should be of a handoff-based sign-in method.
If you do allow it, keep the approval scope narrow. Limit it to specific applications, specific user groups and specific device classes, then review those exceptions regularly. A broad “allowed everywhere” setting turns a compatibility feature into a standing attack surface.
Operationally, teams should be able to explain why the workflow cannot use a stronger method, how the user is expected to verify the prompt, and what signals will be reviewed if the flow is abused. If you want examples of how attackers exploit these handoff patterns, AiTM Phishing Guide and Top 10 Phishing Techniques both show why device-code style prompts are attractive to adversaries.
Risk and Threat Considerations
Device code flow creates a clean social-engineering path because the attacker does not need to defeat the password prompt directly. They only need to persuade the user to complete a legitimate looking handoff, then capture the resulting session or token grant. That makes the flow especially sensitive where users are accustomed to “just entering a code” as a normal support step.
Failure mechanism: The user completes a valid login challenge for an attacker-controlled session, often because the code is phished, relayed or presented in a convincing decoy workflow. The result is not a broken password, but a valid authorisation event that the attacker can reuse.
Impact: The compromise can grant access to mail, SaaS, APIs or internal tools without triggering the same obvious signs as password theft. In higher-privilege scenarios, the blast radius can include session theft, persistence through refresh tokens, and follow-on abuse of trusted application access.
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 and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST SP 800-63 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP API Security Top 10 | API2 — Broken Authentication | Device code flow is an authentication method with phishing and session-risk tradeoffs. |
| Recommendation — Require stronger authentication and narrow approval for flows that create a handoff-based login path. | ||
| NIST SP 800-63 | Digital Identity Guidelines | The question is about choosing an authentication method and its assurance tradeoff. |
| Recommendation — Use the digital identity guidance to prefer stronger authenticators where the device can support them. | ||
| OWASP Non-Human Identity Top 10 | NHI-04 — Insecure Authentication | The flow can weaken authentication when the handoff is easy to phish or relay. |
| Recommendation — Block broad use of weak handoff-based authentication and limit exceptions to justified workflows. | ||
| CIS Controls v8 | CIS-6 — Access Control Management | Allowing the flow is an access-control decision that should be scoped and reviewed. |
| Recommendation — Restrict the flow to approved use cases and review exceptions as part of access control. | ||
Practitioner Guidance
What to verify: Confirm that the target device genuinely cannot support a stronger authentication method before approving the flow. If a phishing-resistant option is available, treat device code flow as an exception that needs justification, not as a convenience default.
Decision rule: If the workflow touches privileged users, sensitive data or broad SaaS access, require a stronger method unless there is a hard device constraint that cannot be removed in the near term. If the device is shared, unmanaged or exposed to public users, treat the flow as higher risk and narrow its use further.
Common mistake: Allowing device code flow because it “works everywhere” and then expanding it quietly into ordinary user access. That turns a fallback into a routine authentication path and increases the chance that a phishing prompt or token theft event becomes a successful compromise.
Practitioner takeaway: Allow device code flow only as a tightly scoped compatibility exception, then review whether the workflow should be redesigned toward a stronger and more verifiable sign-in method.
Related resources from NHI Mgmt Group
- How can organisations decide whether device flow is appropriate for a CLI application?
- How do organisations decide whether to move from implicit flow to authorization code flow in web applications?
- How should organisations decide whether to allow MCP in sensitive systems?
- When should organisations block device code flow entirely?
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 22, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org