You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/oauth2-oidc/device-authorization.mdx
+37-19Lines changed: 37 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,25 +4,26 @@ title: Device Authorization
4
4
sidebar_label: Device authorization flow
5
5
---
6
6
7
-
The OAuth 2.0 Device Authorization Grant (RFC 8628) brings OAuth to devices with internet connectivity but limited input
8
-
capabilities. This flow is designed for smart TVs, streaming devices, IoT hardware, printers, remote terminal sessions, AI agents, and other connected devices
9
-
where typing credentials or opening a browser isn't practical or possible. Here's how it works: the device to be authenticated displays a URL and a short code, prompting
10
-
you to open that URL on your phone or computer to authorize access. After successful authorization, the device will get an access and (optionally) a refresh token. The two devices don't need to communicate directly—the authorization
11
-
happens through the OAuth provider.
7
+
The OAuth 2.0 Device Authorization Grant (RFC 8628) brings OAuth to devices with internet connectivity but limited input
8
+
capabilities. This flow is designed for smart TVs, streaming devices, IoT hardware, printers, remote terminal sessions, AI agents,
9
+
and other connected devices where typing credentials or opening a browser isn't practical or possible. Here's how it works: the
10
+
device to be authenticated displays a URL and a short code, prompting you to open that URL on your phone or computer to authorize
11
+
access. After successful authorization, the device will get an access and (optionally) a refresh token. The two devices don't need
12
+
to communicate directly—the authorization happens through the OAuth provider.
12
13
13
-
This document provides an overview of the Ory's device authorization grant flow, with a step-by-step example of its implementation, configuration
14
-
options, and guidance on creating custom user interfaces for the verification screen.
14
+
This document provides an overview of the Ory's device authorization grant flow, with a step-by-step example of its
15
+
implementation, configuration options, and guidance on creating custom user interfaces for the verification screen.
15
16
16
17
## Overview of the flow
17
18
18
19
Here is the high-level overview for the device authorization grant flow:
19
20
20
21
1. The user attempts to log in to the device. This initiates the device to request authorization from the authorization server.
21
-
1. When the authorization server responds, the user is instructed to visit a URL and enter the provided user code, which they do
22
+
1. When the authorization server responds, the user is instructed to visit a URL and enter the provided user code, which they do
22
23
on a different device.
23
24
1. On the different device the user visits the URL, enters the user code, (logs in, if needed) and grants access to the device.
24
-
1. In the meantime, the device polls the authorization server. Once the user authenticates and grants access, the authenicaton server
25
-
sends an access token to the device, which is used to access the protected resource.
25
+
1. In the meantime, the device polls the authorization server. Once the user authenticates and grants access, the authenicaton
26
+
server sends an access token to the device, which is used to access the protected resource.
26
27
27
28
```mdx-code-block
28
29
import Mermaid from "@site/src/theme/Mermaid";
@@ -59,8 +60,8 @@ import Mermaid from "@site/src/theme/Mermaid";
59
60
60
61
### Step 1: Device requests authorization
61
62
62
-
The user attempts to log in through the limited input device. The device sends a POST request to the authorization server to initiate
63
-
the flow with the following parameters:
63
+
The user attempts to log in through the limited input device. The device sends a POST request to the authorization server to
64
+
initiate the flow with the following parameters:
64
65
65
66
-`client_id`: The ID of the client (device) that's making the request
66
67
-`scope` (optional): The scope of the access request, which specifies which resources the requesting device can access
@@ -76,12 +77,13 @@ The authorization server responds with the following information:
76
77
77
78
### Step 2: Display user code and verification URI
78
79
79
-
The device shows the user the `user_code` and `verification_uri` it received from the authorization server. Depending on the device, this can be in the form of a URL, QR-code, acoustically, or any other form that the device can communicate with the user.
80
+
The device shows the user the `user_code` and `verification_uri` it received from the authorization server. Depending on the
81
+
device, this can be in the form of a URL, QR-code, acoustically, or any other form that the device can communicate with the user.
80
82
81
83
### Step 3: User grants permission
82
84
83
-
The user visits the provided URI on a separate device, such as a phone, and enters the code. Once the user enters the code,
84
-
the user is prompted to log in, if not already authenticated, and grants or denies permission to the client (device). After granting
85
+
The user visits the provided URI on a separate device, such as a phone, and enters the code. Once the user enters the code, the
86
+
user is prompted to log in, if not already authenticated, and grants or denies permission to the client (device). After granting
85
87
permission, the user is redirected to a page confirming they are successfully logged in.
86
88
87
89
### Step 4: Device polls for the access token
@@ -93,7 +95,8 @@ user has completed the authorization process, by making a POST request with the
93
95
-`device_code`: The device code returned from the authorization request
94
96
-`grant_type`: This must always be `urn:ietf:params:oauth:grant-type:device_code`
95
97
96
-
After the user grants their consent, the authentication server sends an access token to the device, which is used to access the protected resource.
98
+
After the user grants their consent, the authentication server sends an access token to the device, which is used to access the
99
+
protected resource.
97
100
98
101
## Configuration options
99
102
@@ -112,14 +115,29 @@ urls:
112
115
113
116
### Configuring user code entropy
114
117
115
-
Depending on your security needs and your traffic load, you should choose the appropriate `user_code` entropy. The
118
+
Depending on your security needs and your traffic load, you should choose the appropriate `user_code` entropy. The
0 commit comments