IAM interview questions · Architecture and scenarios
How do you log in on a TV or a CLI with no browser?
In plain wordsThe TV shows a short code; you type it on your phone, where logging in is easy, and the TV gets in by itself.
How it works
The device authorization grant (RFC 8628) is for devices with no browser or keyboard: smart TVs, CLIs, IoT. The device asks the IdP for a device_code and a short user_code, shows the user_code and a URL, and polls the token endpoint.
The user opens the URL on a phone or laptop, logs in with full MFA and enters the code. When approved, the next poll returns tokens. Risk: attackers use device code phishing, sending a victim a real code they generated, so show clearly which device and app is asking and limit the flow to clients that need it.
A concrete example
A developer runs “cloud-cli login” on a server via SSH. The CLI prints “Go to https://login.example.com/device and enter WDJB-MJHT”. On their laptop they log in with a passkey, approve “Cloud CLI on server prod-07”, and the CLI receives tokens.
See it in action: sign in on a TV
Mistakes to avoid
- Leaving device code enabled for every app, which phishing campaigns abuse.
- Polling too fast and ignoring slow_down.
They may also ask you
- How would you detect device code phishing?
- Why not ask for the password directly on the device?
- Go deeper
- Sign in on a TV →
- Device Code flow →