@@ -30,26 +30,30 @@ but generally, it is assumed the device is unable to safely store the client sec
30
30
Ensure the setting ``OAUTH_DEVICE_VERIFICATION_URI `` is set to a URI you want to return in the
31
31
`verification_uri ` key in the response. This is what the device will display to the user.
32
32
33
- 1: Navigate to the tests/app/idp directory:
33
+ 1. Navigate to the tests/app/idp directory:
34
34
35
35
.. code-block :: sh
36
36
37
37
cd tests/app/idp
38
38
39
39
then start the server
40
+
40
41
.. code-block :: sh
41
42
42
43
python manage.py runserver
43
44
44
- To initiate device authorization, send this request:
45
+ .. _RFC : https://www.rfc-editor.org/rfc/rfc8628
46
+
47
+ 2. To initiate device authorization, send this request (in the real world, the device
48
+ makes this request). In `RFC `_ Figure 1, this is step (A).
45
49
46
50
.. code-block :: sh
47
51
48
52
curl --location ' http://127.0.0.1:8000/o/device-authorization/' \
49
53
--header ' Content-Type: application/x-www-form-urlencoded' \
50
54
--data-urlencode ' client_id={your application client id}'
51
55
52
- The OAuth2 provider will return the following response:
56
+ The OAuth2 provider will return the following response. In ` RFC `_ Figure 1, this is step (B).
53
57
54
58
.. code-block :: json
55
59
@@ -61,31 +65,41 @@ The OAuth2 provider will return the following response:
61
65
"interval" : 5
62
66
}
63
67
64
- Go to `http://127.0.0.1:8000/o/device ` in your browser.
68
+ In the real world, the device will somehow make the value of the `user_code ` available to the user (either on-screen display,
69
+ or Bluetooth, NFC, etc.). In `RFC `_ Figure 1, this is step (C).
70
+
71
+ 3. Go to `http://127.0.0.1:8000/o/device ` in your browser.
65
72
66
73
.. image :: ../_images/device-enter-code-displayed.png
67
74
68
- Enter the code, and it will redirect you to the device-confirm endpoint.
75
+ Enter the code, and it will redirect you to the device-confirm endpoint. In ` RFC `_ Figure 1, this is step (D).
69
76
70
77
Device-confirm endpoint
71
78
-----------------------
72
- Device polling occurs concurrently while the user approves or denies the request.
79
+ 4. Device polling occurs concurrently while the user approves or denies the request.
73
80
74
81
.. image :: ../_images/device-approve-deny.png
75
82
76
83
Device polling
77
84
--------------
78
- Send the following request (in the real world, the device makes this request):
85
+ Send the following request (in the real world, the device makes this request). In ` RFC `_ Figure 1, this is step (E).
79
86
80
87
.. code-block :: sh
81
88
82
89
curl --location ' http://localhost:8000/o/token/' \
83
90
--header ' Content-Type: application/x-www-form-urlencoded' \
84
91
--data-urlencode ' device_code={the device code from the device-authorization response}' \
85
- --data-urlencode ' client_id={your application\ ' s client id}' \
92
+ --data-urlencode ' client_id={your application client id}' \
86
93
--data-urlencode ' grant_type=urn:ietf:params:oauth:grant-type:device_code'
87
94
88
- The response will be similar to this:
95
+ In `RFC `_ Figure 1, there are two options for step (F). Until the user enters the code in the browser and approves,
96
+ the response will be 400:
97
+
98
+ .. code-block :: json
99
+
100
+ {"error" : " authorization_pending" }
101
+
102
+ After the user approves, the response will be 200:
89
103
90
104
.. code-block :: json
91
105
0 commit comments