@@ -30,26 +30,30 @@ but generally, it is assumed the device is unable to safely store the client sec
3030Ensure the setting ``OAUTH_DEVICE_VERIFICATION_URI `` is set to a URI you want to return in the
3131`verification_uri ` key in the response. This is what the device will display to the user.
3232
33- 1: Navigate to the tests/app/idp directory:
33+ 1. Navigate to the tests/app/idp directory:
3434
3535.. code-block :: sh
3636
3737 cd tests/app/idp
3838
3939 then start the server
40+
4041.. code-block :: sh
4142
4243 python manage.py runserver
4344
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).
4549
4650.. code-block :: sh
4751
4852 curl --location ' http://127.0.0.1:8000/o/device-authorization/' \
4953 --header ' Content-Type: application/x-www-form-urlencoded' \
5054 --data-urlencode ' client_id={your application client id}'
5155
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).
5357
5458.. code-block :: json
5559
@@ -61,31 +65,41 @@ The OAuth2 provider will return the following response:
6165 "interval" : 5
6266 }
6367
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.
6572
6673.. image :: ../_images/device-enter-code-displayed.png
6774
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).
6976
7077Device-confirm endpoint
7178-----------------------
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.
7380
7481.. image :: ../_images/device-approve-deny.png
7582
7683Device polling
7784--------------
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).
7986
8087.. code-block :: sh
8188
8289 curl --location ' http://localhost:8000/o/token/' \
8390 --header ' Content-Type: application/x-www-form-urlencoded' \
8491 --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}' \
8693 --data-urlencode ' grant_type=urn:ietf:params:oauth:grant-type:device_code'
8794
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:
89103
90104.. code-block :: json
91105
0 commit comments