When a Zitadel device authorization flow fits your product
Use the device authorization grant when the client that needs a user's identity cannot host a normal browser login. Zitadel provides a device authorization grant for devices such as smart TVs, and this page covers how to configure it, run the user code and polling sequence, and limit what device tokens can do. The typical cases are a streaming app on a TV or set-top box, a command-line tool that runs on a server or laptop without a usable browser, and an IoT device with a screen that is awkward to type on. In each case the user completes sign-in on a separate device with a keyboard and browser, and the constrained client waits for the result.
The grant is designed for input-limited clients. It is not a general replacement for the authorization code flow with PKCE, which remains the right choice for single-page apps, native mobile apps and any client that can open a browser and receive a redirect. If your client can open a system browser and catch a redirect, PKCE keeps the user in a familiar login experience with fewer moving parts. Confirm the client type first: a CLI that can launch a local browser may not need the device flow at all, while a headless device with no browser usually does. Check the device flow setup in your Zitadel application settings and confirm with your Zitadel version's documentation that the grant type is enabled for that application before you commit the design.
Configuration options and when each fits
This table compares the decisions a team makes when setting up the device client in Zitadel: application type, scopes and token types, refresh tokens, polling behavior, and user code settings. Read each row as a choice to confirm in your own Zitadel instance, since the exact defaults and accepted values should be checked in the console and documentation for your version.
| Decision | Option | Trade-off | When it fits |
|---|---|---|---|
| Application type | Native application with the device grant enabled | Matches a client that cannot keep a secret, so no client secret is embedded in firmware or CLI binaries | TVs, CLIs and IoT clients that ship to end users or run on machines you do not fully control |
| Application type | Web application with a client secret | Secret must be stored and rotated on the device, which is hard to protect on distributed hardware | Only where the device runs in a server-side environment you operate and can protect the secret |
| Scopes | openid and profile, plus offline_access when refresh is needed | Narrower scopes limit what a stolen device token can call, but each API may need its own scope or audience | Single-purpose devices such as a kiosk or TV app that reads one API |
| Scopes | Additional API audiences and project roles | More access in one grant, larger tokens and a broader blast radius if the device is compromised | Tools that must call several internal APIs under one user sign-in |
| Token type | Opaque access tokens with introspection | Revocation takes effect at the next introspection call, but the API adds a network dependency | Devices where a lost unit must lose access quickly and your APIs already support introspection |
| Token type | JWT access tokens validated locally | Offline validation with no introspection call, but a revoked token stays valid until it expires | High-volume APIs where latency matters more than immediate revocation |
| Refresh tokens | Issue refresh tokens to the device | Users stay signed in for longer, and the device must store the refresh token securely and handle rotation | CLIs and long-lived tools where repeated sign-in would hurt usability |
| Refresh tokens | No refresh tokens, repeat the device flow | Each new session needs a user to approve a code, which suits shared TVs or rarely used devices | Shared or public devices where a stored credential is a larger risk than a re-approval |
| Polling interval | Follow the interval returned by the authorization server and handle slow_down | Respecting the interval avoids throttling and errors, and the client must back off when told to | Every device client, since ignoring the interval causes rejected polls |
| User code format and expiry | Use the code and expiry Zitadel issues for the instance | Short codes are easier to type on a TV but are easier to guess, so expiry and rate limits matter | Most TV and CLI flows where a person types the code on a phone or laptop |
Setting up the device flow in Zitadel step by step
This sequence takes a Zitadel project from the right organization to a device client that shows a user code, waits for approval and receives tokens without a browser on the device itself.
Select the organization and project
Decide which organization will own the device client, then create or select the project that holds the application and its roles. Keep the project in the organization where the users who will sign in actually live, because users and grants are scoped to organizations. Confirm the organization and project names in the console, since the exact labels and navigation depend on your Zitadel version. The step is done when the project appears under the correct organization and you can list the users who should be able to sign in through it.
Register a native application with device grant
Inside the project, add an application of the native type, which fits a CLI or a device with no browser of its own. Enable the device authorization grant in the application's grant settings and confirm that no unnecessary grants, such as implicit flow, are turned on. Record the client ID and note the auth method the client will use, which for a public CLI is usually no client secret. Confirm the exact grant and auth method labels in your version of the console. The step is done when the application shows the device code grant as enabled and you have the client ID stored where the client build can read it.
Define scopes, roles and grants
List the scopes the device needs, such as openid, profile and offline_access if refresh tokens are required, and add any API audience the tokens must carry. Create project roles for what devices may do, and grant them to the users or user groups who will use the device, so that role claims reach the token. Keep device roles narrower than interactive roles where the device sits in a shared or unattended location. The step is done when a test user holds the expected role and the scope list in the client matches what you configured in the console.
Start a device login from the client
Run the client's device authorization request against the Zitadel device endpoint and capture the response. You should receive a device code, a user code, a verification URI and a polling interval. Display the verification URI and user code to the person at the terminal or on the screen, and keep the device code private to the client process. The step is done when the request returns all expected fields and the client prints the verification information without errors.
Test the verification page on a second device
On a separate phone or laptop, open the verification URI, enter the user code and sign in as the test user. Approve the request and check that the consent screen lists the scopes you defined. Try the same flow with a user who lacks the role to confirm access is refused. Confirm the approval page wording and the code format in your Zitadel version before writing user instructions. The step is done when the approved user completes the flow and the unauthorized user does not receive tokens.
Confirm polling behavior in the client
Configure the client to poll the token endpoint at the interval the server returned, and to handle the pending, slow down and access denied responses defined by the device grant. Stop polling when the code expires or the user denies the request, and never poll faster than the interval. Check that the client stores tokens securely after success and that it does not log the device code. The step is done when a test run shows pending responses until approval, tokens after approval, and a clean exit when the user denies or the code expires.
Verify token claims and limits
Decode the issued access and ID tokens, or call userinfo, and confirm the audience, scopes and role claims match the design from the earlier steps. Check token lifetime and whether a refresh token was issued, and confirm how your team will revoke device sessions when a device is lost. Record the settings you verified so a reviewer can repeat the check after upgrades. The step is done when the claims match the documented design and you have a written list of the lifetime and revocation settings to confirm with your security team.
How the device, user browser and Zitadel exchange messages
The flow starts when the CLI or TV app asks Zitadel for a device code and a user code. The device shows the user code and the verification URL, and the user opens that URL in a phone or laptop browser, signs in, and approves the request. The device keeps polling the token endpoint until Zitadel issues tokens or the codes expire. Check that the device never handles the user's password and that the polling interval is respected.
Device, user browser and Zitadel exchange during RFC 8628 sign-in.
Protecting device tokens and the approval step
A device flow moves the sign-in decision to a second screen, so the risks sit in the code, the approval step and the tokens the device keeps afterward. The cards below cover each risk in turn and name the settings to verify in your Zitadel instance before a device goes into use.
User code phishing
Attackers can start a device flow themselves, then send the user code to a victim with a message that looks like support. The victim approves the sign-in on their own phone or laptop, and the attacker's device receives the tokens. Check that the approval page shows the client name and requested scopes, that users are told to enter codes only on the device they are looking at, and that codes expire quickly and are single use in your configuration.
Zitadel APIsRefresh tokens on shared devices
A TV in a lobby or a CLI on a shared build machine may keep a refresh token long after the person who signed in has left. Decide per client whether refresh tokens are issued at all, and if they are, how long they remain valid. Confirm the token lifetimes configured for the device application, and make sure the device stores tokens in a location that only the service account or the signed-in user can read.
Polling abuse and rate limits
The device polls the token endpoint until the user approves, and a faulty or hostile client can poll far faster than the specified interval. Clients should respect the interval returned in the device authorization response and back off on slow_down responses. On the server side, check whether your deployment applies rate limiting to the token endpoint and how it is configured, and monitor token endpoint errors for clients that ignore the interval.
Scope minimization for devices
A device rarely needs the full set of scopes an interactive web app requests. Request only the scopes the device uses, such as a read-only profile or a single API audience, and avoid offline access unless the device must work without a user present. Review the scopes on the device application in your project and remove any that the device code does not call.
Revoking a lost device
When a TV is returned or a laptop with a CLI is lost, the tokens it holds must stop working without waiting for expiry. Plan who can revoke a session or refresh token, how the request is made, and how quickly access to downstream APIs ends. Test the revocation path before go-live, and confirm with your team how opaque and JWT access tokens behave after revocation, since JWTs stay valid until they expire unless your APIs check revocation.
Audit logging of approvals
Each device approval is a sign-in event that a security team may need to reconstruct later. Confirm that your instance records the device authorization request, the approving user, the client, the time and the scopes granted, and that these events are forwarded to your log platform with retention that matches your policy. Ask Zitadel and your own team which events are emitted for device flows, since the exact event set should be verified in your version.
Limiting device tokens: lifetime, scope and revocation
A device that signs users in should receive the least it needs, and that starts with deciding which tokens it gets at all. The device authorization grant in Zitadel issues an access token to the device, and the first decision is whether the device should also receive a refresh token. For a smart TV that shows one catalog and never needs to act again after the session ends, an access token alone is often enough, and the user simply signs in again when it expires. For a CLI that calls an API on the user's behalf for hours or days, a refresh token removes repeated sign-ins but also creates a long-lived credential sitting on a laptop or in a CI runner. Write that decision down per client, and confirm in your Zitadel version whether refresh tokens can be turned off for the device application type and whether the grant types are set per application.
Next, shorten what the device can do before you shorten how long it lives. Request only the scopes the device needs, such as openid and profile for a TV that displays a name, and add API scopes only for the resources it calls. Project roles should be granted narrowly, and the grant should go to a project and application the device uses alone, so a token from a TV client cannot satisfy a role check in an admin API. Confirm how access token lifetimes are configured for each application in your Zitadel version, and whether that setting can differ between a device client and a web client in the same project. Where the lifetime cannot be set per client, reduce the exposure at the resource server by checking audience and roles on every call.
Plan revocation before the first device is issued. Zitadel documents session management for users, so confirm how an administrator ends the sessions of one user or all sessions for one client, and whether that also stops refresh token use. Test the path: sign in a CLI, revoke its session from the console or API, and check that the next API call fails within the lifetime you configured. Decide who can perform revocation, how a lost laptop is reported, and how a user's removal from a project or organization stops token issuance. Keep the test results with the client record, because the answer to "how do we cut off a stolen device token" is an operational question auditors and security teams ask early.
Limits to confirm in your Zitadel version and environment
The device authorization flow depends on details that change between Zitadel releases and between deployments: the version you run, the code and polling settings, the device libraries you choose, and how your proxy and identity policies behave. Confirm each item with Zitadel and in a test environment before you commit the design.
Supported Zitadel version
Confirm that the device grant is available and enabled in the exact version you plan to run, and check the release notes for changes to it. Zitadel v4.19.5 was released on 15 October 2026, so if your planned version predates that release, check whether the device flow behavior you rely on has changed. Ask the vendor which release you should pin for production and plan your upgrade path around it.
Zitadel releasesUser code length and expiry
The user code is what a person types on a second screen, so its length, character set and lifetime determine how easily people complete sign-in and how easily an attacker could guess a code. Find out whether these values are configurable in your version, where they are set, and whether they apply per application or per instance. Test the flow with a code that expires during a slow login to confirm the device shows a clear error.
Polling interval guidance
The device polls the token endpoint until the user approves the request, and RFC 8628 defines the interval the server returns and how a client must respond to slow-down errors. Confirm the interval Zitadel returns, and make sure your device code respects it and backs off when told to. Polling too fast can get the device throttled, and polling too slowly makes sign-in feel stalled on a TV.
Client library support on the device
Many TV platforms and embedded runtimes have no maintained OAuth library that implements the device grant. Check whether the library you choose supports the device authorization request, the polling loop and the error codes defined in the specification. If none fits, plan to implement the small HTTP exchange yourself and test it against the token endpoint, including error paths.
Behavior behind your reverse proxy
The verification URI and the token endpoint must be reachable and must present the public hostname that the device and the user's phone both see. Confirm that your proxy forwards the host and protocol headers Zitadel expects and that the verification page loads over HTTP/2 or HTTP/1.1 as your proxy is configured. A misconfigured external domain often shows up only when a user opens the verification page on a phone.
Self-hosting overviewOrganization identity providers and MFA
Users who sign in through an organization's external identity provider, or who must complete multi-factor authentication, go through a longer browser flow after entering the user code. Confirm that the device flow redirects to the correct organization login, that the identity provider's own MFA and session rules apply, and that the resulting tokens carry the roles and scopes you expect. Test one account from each organization that signs in this way.
Questions teams ask before building a device flow
Can our in-house team build a device authorization flow with Zitadel?
Yes, a capable team can build it, because Zitadel documents a device authorization grant for devices such as smart TVs and the protocol itself (RFC 8628) is well specified. The harder part is rarely the first working login. It is the surrounding work: configuring a native application correctly, handling user code display and expiry, polling behavior, error states, and testing on each device platform you support. Ask whether your team has done this before on constrained hardware, and whether it can own the test matrix after launch. A partner is useful when the team lacks that experience or lacks the time to test across devices.
What drives the effort of a device flow project?
Effort grows with the number of device types, the number of identity providers a user may sign in through, the level of branding on the verification page, and the breadth of testing. Each additional TV platform, CLI operating system or IoT firmware family adds its own polling, storage and display constraints. Each identity provider federated into Zitadel adds login paths that must be tested with the device flow. Branding adds design review. Testing adds the most time when devices are hard to automate. Ask any provider to list these items separately in the written scope so you can see which ones you would remove to reduce cost.
What does the work need from our side?
Plan for four inputs before work starts: test user accounts in the relevant Zitadel organization with the roles your applications expect, physical or emulated access to every device type in scope, an administrator who can create and configure the native application in the Zitadel instance, and a named contact who approves the user code page wording and branding. Missing device access is the most common delay, because testing on real hardware is where polling and display issues appear. Confirm these inputs in writing so that the schedule reflects who is responsible for each one.
How long does a device flow implementation take?
The duration depends on the scope you agree, and no fixed figure applies across all cases. A single device type with one identity provider and standard branding is a narrower project than several device families with federated logins and custom verification pages. Timelines should come from the written scope, with milestones for the application setup, the device client, the verification page, testing on each device and the operational handover. Ask for the schedule to show which milestones depend on device access and administrator availability, since those dependencies usually set the critical path.
Does the device flow work with self-hosted Zitadel?
Yes, Zitadel documents a device authorization grant, and self-hosting does not remove it. Zitadel documents self-hosting on Linux and macOS binaries, Docker Compose and Kubernetes, and recommends Kubernetes with the official Helm chart for high availability. The device flow depends on the verification URL being reachable by users on their phones or laptops, so public DNS, TLS and the external domain configuration matter. Confirm with the Zitadel documentation for your chosen version that the grant and the native application settings match your deployment, and test the verification page through the same ingress your users will use.
Can we do this ourselves without a partner?
Yes, if your team has the skills and the time, and the open-source Zitadel documentation covers the protocol and the configuration. A partner adds value in three places: a written scope with testing across your actual device families, a security review of how device tokens are issued, limited and revoked, and a handover with runbooks your operations team can use. Compare the cost of those activities with the cost of your own engineers' time and the risk of a weak rollout. Ask any provider what they will not test, so you know the residual risk before you decide.
What security checks apply to device tokens?
Device tokens need the same discipline as other user tokens, with extra attention to how they are stored on devices that may be shared or hard to patch. Decide the token lifetime, whether refresh tokens are issued to the device, how a lost device is revoked, and which scopes the device can request. Limit what a device can do with its tokens and log sign-in events so that unusual activity can be traced. Confirm these settings in Zitadel and in your own policy, and ask for a test that shows a revoked session stops working on the device.
How DeployOpen scopes and delivers device authentication
DeployOpen agrees the device flow scope in writing before any configuration begins. The scope names each device class (smart TV apps, CLI tools, IoT gateways), the Zitadel instance and organization that will hold the users, the project and grants that control which roles can sign in on a device, and the token lifetimes and refresh behavior the client has approved. It also records who approves the verification page policy, who owns the native application client in Zitadel, and which of the client's own teams will run the service afterward. Clients should expect the written scope to list the devices and user populations covered, and any device types excluded, such as shared kiosks that cannot hold a refresh token securely.
Implementation runs inside the client's own infrastructure. DeployOpen creates the native application in Zitadel with the device authorization grant enabled, sets the scopes and redirect behavior, and wires the verification URI to the hosted login the client has deployed. The CLI or device-side code is built against the polling interval and error handling that RFC 8628 defines, so authorization_pending and slow_down responses are handled rather than treated as failures. Hardening covers rate limits on the device code endpoint, short user code lifetimes, restricted project roles and logging of approvals, with settings confirmed against the Zitadel version the client runs.
Testing focuses on the approval and token behavior that users and auditors notice: whether a denied or expired code fails cleanly, whether a token issued to one device can be revoked, whether role claims match the project grants, and whether an approval from an unexpected account is refused. DeployOpen then documents the device client configuration, the runbook for revoking device sessions, and the monitoring signals the client's operations team should watch. Clients should ask for that documentation and retest evidence as named deliverables in the quote, and confirm with their own security team which revocation and logging requirements apply to their environment.

