Configure Device Authorization Grant Flow
Number of APIs: 9
This activity shows you how to initiate a device authorization grant flow to send an activation code to the end user. The authorization and flow orchestration steps apply only to applications that specify device_code as a grant type in the application configuration.
The following operations are supported by the PingOne APIs:
- Create an application
- Create a population and a user
- Initiate an authorize request
- Use flow APIs to complete the flow
Prerequisites
- Get an access token from the worker application you created in Getting Started with the PingOne APIs. If you prefer to get a token from a different worker application in an alternate sandbox environment, run the token request endpoint using the client ID and client secret of your chosen worker app to authenticate the request. See GET a Worker Application Access Token.
Workflow order of operations
To configure a device authorization grant flow using the environment's default sign-on policy, the following tasks must be completed successfully:
Make a
POSTrequest to/environments/{{envID}}/applicationsto add a new application to the specified environment.Make a
POSTrequest to/environments/{{envID}}/populationsto create a new population resource.Make a
POSTrequest to/environments/{{envID}}/usersto create a user who will be assigned to the new population resource.Make a
PUTrequest to/environments/{{envID}}/users/{{userID}}/passwordto set the new user's password.Make a
POSTrequest to/{{envID}}/as/device_authorizationto return the device code and the user code.Make a
GETrequest to/{{envID}}/deviceto initiate authorization and return a flow ID.Make a
GETrequest to/{{envID}}/flows/{{flowID}}to start the flow.To complete the login action, make a
POSTrequest to/{{envID}}/flows/{{flowID}}and provide the user's login credentials.To complete the confirm activation code action, make a
POSTrequest to/{{envID}}/flows/{{flowID}}to submit the activation code.To complete the consent action, make a
POSTrequest to/{{envID}}/flows/{{flowID}}to accept the device authorization grant agreement.Make a
POSTrequest to/{{envID}}/as/tokento exchange the device code for an access token.
-
Step 4: Set user password PUT {{apiPath}}/environments/{{envID}}/users/{{deviceAuthUserID}}/password
-
Step 1: Create a custom application POST {{apiPath}}/environments/{{envID}}/applications
-
Step 2: Create a population POST {{apiPath}}/environments/{{envID}}/populations
-
Step 3: Create a user POST {{apiPath}}/environments/{{envID}}/users
-
Step 10: Accept device authorization grant consent POST {{authPath}}/{{envID}}/flows/{{flowID}}
-
Step 11: Get the access token POST {{authPath}}/{{envID}}/as/token
-
Step 5: Authorize (device) POST {{authPath}}/{{envID}}/as/device_authorization
-
Step 6: Start device flow GET {{authPath}}/{{envID}}/device
-
Step 7: Get the flow GET {{authPath}}/{{envID}}/flows/{{flowID}}