> ## Documentation Index
> Fetch the complete documentation index at: https://developers.authlete.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> ### Authlete versions
> Authlete 3.0 is the current version. Unless the user says they use another version, answer for Authlete 3.0 using the 3.x documentation.
> Documentation for Authlete 2.x (pages under `/v2/` and `/ja/v2/`) is for the legacy version. Refer to it only when the user is on Authlete 2.x.
>
> ### Authlete architecture
> Authlete is a backend engine for OAuth 2.0 and OpenID Connect processing. End users and client applications do not call it directly; the service provider's authorization server and API server call Authlete's APIs. Authlete handles protocol processing and token, client, and service management, while the service provider owns the OAuth/OIDC endpoints and user authentication.
> See [Architecture](https://developers.authlete.com/get-started/introduction-to-authlete/architecture.md).
>
> ### Concepts
> If the user is new to Authlete, read these pages first:
> - [Request and Response](https://developers.authlete.com/get-started/concepts/request-and-response.md): Core API requests pass the client's request parameters as-is, and responses return `resultCode`, `action`, and `responseContent`.
> - [Action Handling](https://developers.authlete.com/get-started/concepts/action-handling.md): Branch on `action`, never on `resultCode`, and map each action to the HTTP response your server returns.
> - [Two-Step API Calls](https://developers.authlete.com/get-started/concepts/two-step-api-calls.md): Actions such as `INTERACTION` are completed with a second call (`/auth/authorization/issue` or `/auth/authorization/fail`) linked by a `ticket`.
> - [Management API Overview](https://developers.authlete.com/get-started/concepts/overview.md): The Management API configures services, manages clients, and operates issued tokens, separately from the protocol flows handled by the Core API.
> - [API Authentication](https://developers.authlete.com/get-started/concepts/authentication.md): Authlete APIs use bearer tokens: a Service Access Token (one service) or an Organization Token (the whole organization).

# Device Flow (OAuth 2.0 Device Authorization Grant)

> Technical information about device flow.

> [!NOTE]
>
> For **Authlete 2.x** documentation, see [2.x version](https://developers.authlete.com/v2/configuration-reference/endpoints/enabling-device-flow.md).

# What is Device Flow?

[RFC 8628 (OAuth 2.0 Device Authorization Grant)](https://tools.ietf.org/html/rfc8628) is a Proposed Standard, published by IETF in August 2019.
It defines an authorization flow (Device Flow) to issue access tokens for API clients running on devices with no Web browsers and/or that have limited capability for inputting text,
with end user consent.

# How it Works

The device flow implies the following preconditions.

* **User** can use devices with Web browsers (e.g. PC, smartphones, tablets)
* **Client** (e.g. TV, appliances) is a device that can establish an outbound connection to the Internet
* **Authorization Server** (e.g. streaming service providers) exposes Device Authorization Endpoint to clients

![Device Flow 01 En](https://mintcdn.com/authlete/WGQFc11Y4wUplGrc/protocols-and-flows/advanced-flows/device_flow_01_en.png?fit=max\&auto=format\&n=WGQFc11Y4wUplGrc\&q=85\&s=ce2866400b508694db7cb9ac512430a8)

Here is an overview of the flow:

1. **Client (device)** sends a device authorization request to device authorization endpoint in Authorization Server.
2. **Authorization Server** replies a device authorization response to Client. The response contains the following main parameters:
   * `user_code`: a value to be submitted from User to Authorization Server.
   * `device_code`: a value for Client to send a token request to Authorization Server.
3. **Client** presents `user_code` to User.
4. The following processes run simultaneously.
   * **Client** sends a token request that includes `device_code` to Authorization Server. The same requests are periodically made (i.e. polling) to Authorization Server until an access token (or an error) is returned.
   * **User** goes to Authorization Server using an Web browser, authenticates itself, submits `user_code` and grants access to Client.
5. **Authorization Server** verifies the `user_code`, issues an access token and sends a token response including the token against the token request that contains the `device_code` that corresponds to the `user_code`.

As a result of the flow above, Client obtains the access token for authorized API requests.

# Authlete and Device Flow

Authlete [version 2.1 and later support the device flow](https://docs.authlete.com/#device-flow).
Developers can simply implement their authorization servers that support the device flow, using the following newly added or enhanced Authlete APIs.

* [`/device/authorization` API](https://docs.authlete.com/#device-authorization-api) (New)
  * Processing a device authorization request. After an authorization server receives the request from a client, it forwards the content of the request as a value to this API.
    Authlete inspects the content. If it is valid, Authlete creates another content of a device authorization response and send it back to the authorization server.
    The authorization server passes the device authorization response back to the client.
* [`/device/verification` API](https://docs.authlete.com/#device-verification-api) (New)
  * Verifying `user_code`.
* [POST /device/complete](https://developers.authlete.com/api-reference/device-flow/complete-device-authorization.md) API (New)
  * Processing approval/denial of the ongoing device flow. The processing result affects a response from `/auth/token` API.
* [POST /auth/token](https://developers.authlete.com/api-reference/token-endpoint/process-token-request.md) API (Enhanced)
  * Processing token requests.
    It is enhanced to support `grant_type=urn:ietf:params:oauth:grant-type:device_code` and corresponding `device_code` parameter.

![Device Flow 02 En](https://mintcdn.com/authlete/WGQFc11Y4wUplGrc/protocols-and-flows/advanced-flows/device_flow_02_en.png?fit=max\&auto=format\&n=WGQFc11Y4wUplGrc\&q=85\&s=c0bdf752213ceb9b920e6ed096d7c915)

You can manage settings for the device flow using the Authlete Management Console.

![Device Flow 03 En](https://mintcdn.com/authlete/DJSnuSnO9PCDKxpJ/protocols-and-flows/advanced-flows/device_flow_03_en.png?fit=max\&auto=format\&n=DJSnuSnO9PCDKxpJ\&q=85\&s=88f18dac61482f89ce0ed6b1f6bf316b)

# Detailed Information

* [Illustrated Device Flow (RFC 8628)](https://medium.com/@darutk/illustrated-device-flow-rfc-8628-d23d6d311acc)
  * A detailed explanation of the device flow specification and Authlete's implementation and its usage.
* [Authlete API Reference](https://docs.authlete.com/)
  * Reference to Authlete APIs.
* [java-oauth-server](https://github.com/authlete/java-oauth-server)
  * A reference authorization server implementation using Authlete APIs.
    It is freely available by Authlete under open source license and supports the device flow.
* [JavaDoc of authlete-java-common](https://authlete.github.io/authlete-java-common/)
  * For further information about the Authlete APIs above,
    refer to descriptions of Device\* classes in the JavaDoc of the [authlete-java-common library](https://github.com/authlete/authlete-java-common).
* [Sequence Diagrams Templates](https://www.authlete.com/resources/templates/sequence-diagrams/)
  * A collection of templates to draw your sequence diagrams of OAuth 2.0 / OIDC (OpenID Connect) flows using Authlete.
    It contains a diagram of the device flow using Authlete.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.