Skip to content

Commit 575aa3c

Browse files
Merge pull request #5772 from piraveena/device-code
Add implement device code section to Asgardeo
2 parents 8332f24 + f2a9191 commit 575aa3c

File tree

4 files changed

+49
-10
lines changed

4 files changed

+49
-10
lines changed
436 KB
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% set product_name = "Asgardeo" %}
2+
{% set product_url_format = "https://api.asgardeo.io/t/{organization_name}" %}
3+
{% set product_url_sample = "https://api.asgardeo.io/t/bifrost" %}
4+
{% include "../../../../../includes/guides/authentication/oidc/implement-device-flow.md" %}

en/asgardeo/mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,7 @@ nav:
342342
- Hybrid flow: guides/authentication/oidc/implement-oidc-hybrid-flow.md
343343
- Pushed Authorization Requests (PAR): guides/authentication/oidc/implement-login-with-par.md
344344
- JWT Secured Authorization Response Mode (JARM) for OAuth 2.0: guides/authentication/oidc/jarm.md
345+
- Device authorization flow: guides/authentication/oidc/implement-device-flow.md
345346
- Client authentication methods:
346347
- Private key JWT: guides/authentication/oidc/private-key-jwt-client-auth.md
347348
- Tokens and validation:

en/includes/guides/authentication/oidc/implement-device-flow.md

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ Refer [how the device authorization flow work]({{base_path}}/references/grant-ty
1010

1111
2. Create a [user account]({{base_path}}/guides/users/manage-users/).
1212

13+
{% if product_name == "WSO2 Identity Server" %}
1314
3. (Optional) Update device flow configurations.
1415

1516
??? note "Device flow configurations"
1617
The device authorization grant is available by default in WSO2 Identity Server. If you need to update configurations, navigate to `<IS_HOME>/repository/conf/deployment.toml` and update the configurations in `[oauth.grant_type.device_code]` section as required.
1718

1819
```
1920
[oauth.grant_type.device_code]
20-
key_length = 7
21+
key_length = 6
2122
expiry_time = "10m"
2223
polling_interval = "5s"
2324
key_set = "BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz23456789"
@@ -30,6 +31,8 @@ Refer [how the device authorization flow work]({{base_path}}/references/grant-ty
3031
| `polling_interval` | The minimum delay of the client between each polling request to the token endpoint. |
3132
| `key_set` | The set of characters that is used to generate the user code. |
3233

34+
{% endif %}
35+
3336
## Get the required codes
3437
First, your app must initiate a login request to the authorization endpoint of {{ product_name }}. After redirecting to {{ product_name }}, the user should be prompted with a login page if the user is not authenticated.
3538

@@ -44,7 +47,7 @@ First, your app must initiate a login request to the authorization endpoint of {
4447
curl -k -X POST
4548
-H 'Content-Type: application/x-www-form-urlencoded'
4649
--data-urlencode 'client_id=<CLIENT_ID>'
47-
https://localhost:9443/oauth2/device_authorize
50+
{{ product_url_format }}/oauth2/device_authorize
4851

4952
```
5053
---
@@ -53,18 +56,20 @@ First, your app must initiate a login request to the authorization endpoint of {
5356
curl -k -X POST
5457
-H 'Content-Type: application/x-www-form-urlencoded'
5558
--data-urlencode 'client_id=bbwJEayR_OMwPkAgm9VOMzLnYLga'
56-
https://localhost:9443/oauth2/device_authorize
59+
{{ product_url_sample }}/oauth2/device_authorize
5760
```
5861

59-
Upon successful execution of the request, the WSO2 Identity Server returns the `user_code`, `devicce_code` and the `verification_uri` to the client device.
62+
Upon successful execution of the request, the {{ product_name }} returns the `user_code`, `device_code` and the `verification_uri` to the client device.
6063

6164
**Sample response**
6265

6366
```
6467
{
65-
"user_code":"s2DqSNK",
66-
"device_code":"d3fe0db1-2334-48fa-b7d9-821ecfad10d5","interval":5000,"verification_uri_complete":"https://localhost:9443/authenticationendpoint/device.do?user_code=s2DqSNK",
67-
"verification_uri":"https://localhost:9443/authenticationendpoint/device.do",
68+
"user_code":"s2DqSN",
69+
"device_code":"d3fe0db1-2334-48fa-b7d9-821ecfad10d5",
70+
"interval":5000,
71+
"verification_uri_complete":"{{ product_url_sample }}/authenticationendpoint/device.do?user_code=s2DqSN",
72+
"verification_uri":"{{ product_url_sample }}/authenticationendpoint/device.do",
6873
"expires_in":3600
6974
}
7075
```
@@ -106,7 +111,7 @@ Use the following cURL to obtain an access token
106111
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:device_code'
107112
--data-urlencode 'client_id=<CLIENT_ID>'
108113
--data-urlencode 'device_code=<DEVICE_CODE>'
109-
https://localhost:9443/oauth2/token
114+
{{ product_url_format }}/oauth2/token
110115
```
111116
---
112117
**Request sample**
@@ -116,7 +121,7 @@ Use the following cURL to obtain an access token
116121
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:device_code'
117122
--data-urlencode 'client_id=bbwJEayR_OMwPkAgm9VOMzLnYLga'
118123
--data-urlencode 'device_code=7411f395-2f3a-4cb5-8562-d7059d69c66f'
119-
https://localhost:9443/oauth2/token
124+
{{ product_url_sample }}/oauth2/token
120125
```
121126

122127
**Sample response**
@@ -128,4 +133,33 @@ Use the following cURL to obtain an access token
128133
"token_type":"Bearer",
129134
"expires_in":3042
130135
}
131-
```
136+
```
137+
138+
{% if product_name == "Asgardeo" %}
139+
140+
!!! note
141+
142+
Find the default values related to the device authorization flow in the Asgardeo.
143+
144+
<table>
145+
<tr>
146+
<td>The length of the user code</td>
147+
<td>6</td>
148+
149+
</tr>
150+
<tr>
151+
<td>The expiry time of the user code and the device code</td>
152+
<td>10 min</td>
153+
</tr>
154+
<tr>
155+
<td>The minimum delay of the client between each polling request to the token endpoint</td>
156+
<td>5 seconds </td>
157+
</tr>
158+
<tr>
159+
<td>The set of characters that is used to generate the user code</td>
160+
<td>BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz23456789</td>
161+
</tr>
162+
163+
</table>
164+
165+
{% endif %}

0 commit comments

Comments
 (0)