Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
The device code flow lets a device with no browser or keyboard get an access token: it shows a short code, and the user approves it on a phone or laptop instead.

What Is the Device Code Flow?
You have used this flow even if you have never heard of it. A smart television displays an eight-character code and a short URL; you type both into your phone, sign in there, and a few seconds later the television is logged in. That is the OAuth 2.0 device authorisation grant, defined in RFC 8628, and it exists for one reason: entering a password with a remote control or on a device with no browser at all is intolerable.
grant_type=urn:ietf:params:oauth:grant-type:device_code, receiving authorization_pending until the user finishes, then an access token and usually a refresh token.Two properties fall out of that design, and both matter. The device never handles the user’s credentials. And the approval happens on a completely different device, over a channel the approving browser cannot inspect.
That second property is the problem. Nothing in the flow proves that the person entering the code is sitting in front of the device that requested it.
The attack writes itself. The attacker starts a device code flow against the victim’s own tenant, receives a genuine user code, and sends it to the target with a plausible instruction—join the briefing, activate your new handset, verify your account for the migration. The victim goes to the real Microsoft or Google sign-in page, with the real certificate and the real domain, authenticates with their real second factor, and types the code. Tokens are issued to the attacker.
There is no fake website to spot, no lookalike domain, and no certificate warning. Conditional access is evaluated against the user’s own compliant device and passes. Microsoft Threat Intelligence documented a sustained campaign using exactly this technique in February 2025, attributed to the actor it tracks as Storm-2372, targeting government, defence, and NGO accounts through messaging platforms. The same pattern has appeared in reporting on several other state-linked groups since.
The device code flow is one of three grants still in regular use for interactive scenarios, and choosing correctly matters. For anything with a browser—web applications, mobile apps, single-page applications—use the authorisation code flow with PKCE. For server-to-server work with no user at all, use the client credentials flow. The device code grant is specifically for input-constrained devices, and using it anywhere else trades a real security property for convenience.
Where you do use it, the tokens it produces deserve the same treatment as any other. Keep refresh token lifetimes short, enable continuous access evaluation so revocation takes effect quickly, and make sure your revocation path is tested, because an incident response that depends on killing attacker sessions needs to work on the day.
At Privia Security, we include device code phishing and other consent-based techniques in our social engineering services.
Because every component the user sees is genuine. The sign-in page is the real identity provider on the real domain with a valid certificate, the multi-factor prompt is the user’s own, and conditional access evaluates their compliant device and passes. The only abnormal element is that the code arrived in a message rather than appearing on a screen in front of them.
Block it by default and allow it only for the specific applications and platforms that need it. Typical legitimate cases are shared meeting room displays, command line tooling, and some developer workflows. Audit sign-in logs first to see which applications currently use the grant, then build the allow list from evidence rather than from guesses about who might complain.
No. The victim completes multi-factor authentication correctly on their own device, and the tokens issued as a result go to the attacker. Only phishing-resistant authentication does not help here either, because the authentication itself is legitimate. The effective controls are blocking the flow, restricting where it is permitted, and user awareness of the single rule about codes received in messages.
Alert on successful sign-ins using the device code grant, since the volume is normally very low. Then look at what follows: a token first used from an address, country, or user agent that does not match the user’s usual pattern, mailbox rule creation, or bulk file access shortly after a device code sign-in are all strong indicators worth escalating immediately.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.