@@ -4,6 +4,8 @@ These apps are for local end to end testing of DOT features. They were implement
44local test environments. You should be able to start both and instance of the IDP and RP using the directions below, then test the
55functionality of the IDP using the RP.
66
7+ The IDP seed data includes a Device Authorization OAuth application as well.
8+
79## /tests/app/idp
810
911This is an example IDP implementation for end to end testing. There are pre-configured fixtures which will work with the sample RP.
@@ -33,6 +35,36 @@ password: password
3335python -Xutf8 ./manage.py dumpdata -e sessions -e admin.logentry -e auth.permission -e contenttypes.contenttype -e oauth2_provider.accesstoken -e oauth2_provider.refreshtoken -e oauth2_provider.idtoken --natural-foreign --natural-primary --indent 2 > fixtures/seed.json
3436```
3537
38+ ### Device Authorization example
39+
40+ For testing out the device authorization flow, we don't really need a RP, as the device itself
41+ is the "relying party". The seed data includes a Device Authorization Application, meaning
42+ you could directly start the device authorization flow using ` curl ` . In the real world, the device
43+ would be sending these request that we send here with ` curl ` .
44+
45+ _ Note:_ you can find these ` curl ` commands in the Tutorial section of the documentation as well.
46+
47+ ``` sh
48+ # Initiate device authorization flow on the device; here we use the client_id
49+ # of the Device Authorization App from the seed data.
50+ curl --location ' http://127.0.0.1:8000/o/device-authorization/' \
51+ --header ' Content-Type: application/x-www-form-urlencoded' \
52+ --data-urlencode ' client_id=Qg8AaxKLs1c2W3PR70Sv5QxuSEREicKUlf83iGX3'
53+ ```
54+
55+ Follow the ` verification_uri ` from the response (should be similar to http://127.0.0.1:8000/o/device "),
56+ enter the user code, approve, and then send another ` curl ` command to get the token.
57+
58+ ``` sh
59+ curl --location ' http://localhost:8000/o/token/' \
60+ --header ' Content-Type: application/x-www-form-urlencoded' \
61+ --data-urlencode ' device_code={the device code from the device-authorization response}' \
62+ --data-urlencode ' client_id=Qg8AaxKLs1c2W3PR70Sv5QxuSEREicKUlf83iGX3' \
63+ --data-urlencode ' grant_type=urn:ietf:params:oauth:grant-type:device_code'
64+ ```
65+
66+ The response should include the access token.
67+
3668## /test/app/rp
3769
3870This is an example RP. It is a SPA built with Svelte.
0 commit comments