Device Authorization Grant

a device with no browser or keyboard shows the user a short code and a URL, the user approves on their phone or laptop, and the device polls the token endpoint until the token arrives.

Where it stands
Published RFC
Official text
RFC 8628
Documented support
4
Activity
0

Read the RFC side by sideExplainer source on GitHub

When you reach for it

  • A smart TV, media console, picture frame or printer that needs to call an API: it can display a URI and a code but has no browser to run a redirect flow, so it asks the user to finish the login on a secondary device (Section 1).
  • A CLI tool on a headless server: the device must be able to make outbound HTTPS requests and show a code, and the user needs a personal computer or smartphone from which they can process the request, which is exactly the spec's operating requirements (Section 1).
  • A device where typing a long URL is painful: the server can return verification_uri_complete with the user_code already embedded, and present it non-textually, such as a QR code or NFC, to save the user from typing the URI (Section 3.3.1).
  • An untrusted device class that cannot keep a client secret: device clients are generally incapable of maintaining the confidentiality of their credentials, and the spec's security section is written with that in mind (Section 5.6).
Diagram
flowchart LR
    A["Device with no browser or keyboard needs a token"] -->|"redirect-based grant: nowhere to render the login"| B["Hard-coded credentials or no OAuth at all"]
    A -->|"device authorization grant"| C["Device shows user_code and verification_uri, user approves elsewhere, device polls for the token"]

The problem it solves

The authorization code grant assumes a user agent that can be redirected to the authorization server and back. A TV or a CLI has no such agent, or has one where typing credentials is impractical. Without a dedicated grant, those devices end up embedding long-lived credentials or asking the user to type a password into a limited input.

The device authorization grant splits the interaction in two. The device talks to the authorization server over HTTPS to get a pair of codes, and the user uses a secondary device to approve. The spec's requirements are that the device is already connected to the Internet, can make outbound HTTPS requests, can display or otherwise communicate a URI and code to the user, and that the user has a secondary device from which they can process the request (Section 1).

How it works

Diagram
sequenceDiagram
    participant D as Device Client
    participant AS as Authorization Server
    participant U as User on secondary device
    D->>AS: POST device_authorization_endpoint, client_id, scope
    AS-->>D: device_code, user_code, verification_uri, verification_uri_complete, expires_in, interval
    D->>U: display verification_uri and user_code
    U->>AS: open verification_uri, enter user_code, authenticate, approve
    D->>AS: POST token endpoint, grant_type=urn:ietf:params:oauth:grant-type:device_code, device_code, client_id
    AS-->>D: error=authorization_pending, or slow_down
    D->>AS: poll again after interval seconds
    AS-->>D: access_token, or access_denied, or expired_token

The device posts to the device authorization endpoint with its client_id and optional scope (Section 3.1). The server answers with device_code, user_code, verification_uri, optionally verification_uri_complete, expires_in for both codes, and optionally interval (Section 3.2). The device shows the user the verification_uri and user_code and instructs them to visit the URI in a user agent on a secondary device (Section 3.3). The device_code is not intended for the end user (Section 3.3). Meanwhile the device polls the token endpoint with grant_type set to urn:ietf:params:oauth:grant-type:device_code, the device_code and its client_id (Section 3.4). Until the user finishes, the server returns authorization_pending, and the device repeats the request after waiting (Section 3.5). When the user approves, the same poll returns the access token.

What the spec requires

  • client_id is required in the device authorization request if the client is not otherwise authenticating, and scope is optional (Section 3.1).
  • The response must include device_code, user_code, verification_uri and expires_in, with verification_uri_complete and interval optional (Section 3.2).
  • If no interval is provided, clients must use 5 seconds as the default (Section 3.2).
  • grant_type in the token request must be urn:ietf:params:oauth:grant-type:device_code, with device_code required (Section 3.4).
  • Before each new request the client must wait at least the number of seconds given by interval, and on slow_down the interval must be increased by 5 seconds for this and all subsequent requests (Section 3.5).
  • access_denied means the user refused, and expired_token means the device_code has expired and the session has concluded (Section 3.5).
  • Server metadata may advertise device_authorization_endpoint (Section 4).

Watch out

  • The user_code is short enough to type, so the server should rate-limit user code attempts, and the code should have enough entropy that brute force fails within the code's lifetime (Section 5.1).
  • The device_code is what the device polls with, so a very high entropy code should be used (Section 5.2).
  • An attacker can send a real user_code to a victim and ask them to approve it, so it is recommended to inform the user that they are authorizing a device and to display information about the device (Section 5.4).
  • The user's own session and device signals are not always relevant to the device being authorized, so do not treat a trusted phone as proof the TV is trustworthy (Section 5.3).
  • If the code is transmitted other than visually, for example by audio, the channel should only be accessible by people in close proximity (Section 5.7).

Sources

How it relates to other specs

Relations diagram
flowchart LR
  s_device_grant["Device Authorization Grant"]
  s_oauth2["OAuth 2.0"]
  s_cross_device_bcp["Security of Cross-Device Flows"]
  style s_device_grant stroke-width:3px
  s_device_grant -->|Extends| s_oauth2
  s_cross_device_bcp -->|Works with| s_device_grant

Documented support

Adoption lists only support stated in official documentation (the vendor's or project's own, or a standards body's page naming it), and a weekly check confirms the cited phrase is still on that page. Experimental, alpha and beta support is counted separately as preview.

Products, identity providers and services

  • Microsoft Entra ID (Identity provider): Supports the device authorization grant source (verified 2026-11-11)
  • Okta (Identity provider): Device Authorization grant on org and custom authorization servers source (verified 2026-11-11)
  • Keycloak (Identity provider): Device flow is listed as a supported server feature source (verified 2026-11-11)

Open-source implementations

  • Authlib (Library): Ships a generic implementation of RFC 8628 source (verified 2026-11-11)

Activity

Revisions from the Datatracker, explanations from this site's daily runs, and mailing-list subjects naming the draft.

Nothing collected about this spec yet.