Skip to main content
If your application runs on a 10 foot/3 meter (10’/3m) device, use the Device Authorization Grant (DAG) flow to obtain tokens on the device. In the DAG flow, the device creates a pending authorization request to Digital Identity Management, and Digital Identity Management responds with secure, long, device code and a much shorter, user-friendly user code. The device presents the user code on page, and invites the user to visit a specific URL. On a separate device (for example, phone, laptop) the user authenticates into Digital Identity Management and approves the user code. Meanwhile, the device has been repeatedly polling the /oidc/token endpoint using the device code to check for approval in the background. Once the user approves, the device receives its tokens.

Flow Diagram

The diagram below represents the communication between the key actors using the Device Authorization Grant flow: OIDC Device Authorization Grant Flow Note: The Device Authorization Grant flow has the significant advantage in that the user does not have to wrestle with entering their credentials using an inconvenient TV interface. Instead, they perform any sign-in operation on a much more convenient handheld device or physical keyboard.

Interaction Steps

The interaction steps between each actor in the flow are as a follows:
  1. The user initiates the login process for your application on the 10’/3m device.
  2. The device calls Digital Identity Management’s POST /oidc/devicecode DAG endpoint with the following HTTP parameters in an x-www-form-encoded body:
  3. Digital Identity Management verifies that the registered RP, specified by the client_id, is configured to allow DAG, and that the scopes are valid for the client. Digital Identity Management then generates and stores a DAG device_code and user_code for the request.
  4. Digital Identity Managements responds to the device with a JSON object that contains the following fields:
  1. Your device UI prompts the user to visit the approval page UI on their mobile device or personal computer. Your device may display the user_code on the page, or use the verification_uri_complete string that incorporates the user_code into the URI. Note: A URL shortener or other mechanism may be used to make the URL easier to type. The device might even translate the URI into a QR code for ease-of-use with a mobile device.
  2. While displaying the verification information on the page, in the background your device repeatedly polls Digital Identity Management’s /oidc/token endpoint to check if the request has been approved. The following HTTP query parameters must be supplied in each request: Note: As per section 3.5 of RFC-8628, if Digital Identity Management did not specify an interval value in the initial POST /oidc/devicecode API response, then your client must assume a default value of 5 seconds. In other words, if Digital Identity Management did not specify an interval, then your client must not poll Digital Identity Management’s oidc/token API faster than once every 5 seconds.
  3. Digital Identity Management responds with HTTP 400 status and a JSON payload that indicates the request is still pending:
    Steps 6 and 7 continue in the background until the user authenticates and approves the device.
  4. The user does as instructed and loads the OIDC device approval URL /oidc/device (or /oidc/device?user_code=X, if the full URL was supplied), as provided by the device UI, onto a separate device. This is an endpoint on Digital Identity Management.
  5. The approval UI checks if the user is authenticated on this device. This can be accomplished by any number of means, such as a call to the Digital Identity Management GET /user API or even a call to /oidc/device?device_code=A endpoint if the user_code is already known. Either API will return 401 Unauthorized message if the user is already signed in.
  6. (Conditional) If the user is currently signed in to Digital Identity Management, then Digital Identity Management redirects them to the approval page in the portal UI with an HTTP 302 redirect. Skip steps 11 through 15 and go to step 16.
  7. (Conditional) If the user is not currently signed in to Digital Identity Management, then Digital Identity Management redirects them to the login page in the portal UI with an HTTP 302 redirect. Proceed to steps 12 through 15.
  8. User authentication typically begins with Digital Identity Management’s POST session/start API, which initializes the Authenticate User Process. If the user needs to or is allowed to onboard first, they may do that instead (not shown in the diagram).
  9. Eventually, whether from a /session/start or other process call, and potentially after several more steps (for example, to satisfy multi-factor authentication rules, if enabled), the final HTTP response from Digital Identity Management indicates that the user is now authenticated, and the approval process can continue.
  10. The user’s browser once again loads the approval endpoint.
  11. Digital Identity Management recognizes the user as signed in and redirects them to the approval page in the portal UI.
  12. (Conditional) If the approval UI was not loaded with the verification_uri_full, then it must prompt the user to enter the user_code that the device displayed on the TV page.
  13. (Conditional) The user enters the user_code to confirm the device that they wish to approve.
  14. The portal calls Digital Identity Management’s /oidc/device endpoint with the single HTTP query parameter user_code set to the value of the user-supplied code.
  15. Digital Identity Management uses the user-supplied code to look up the pending DAG request.
  16. Digital Identity Management returns the details of the pending DAG request as a JSON Object, which resembles the following:
    The fields of the response are as follows:
  1. The default DAG approval presents information about the request to the user, and prompts them to approve.
  2. The user confirms the DAG Request.
  3. The approval UI calls the POST /oidc/device/approve endpoint with the following HTTP query parameters:
  4. Digital Identity Management records the DAG as approved. The next approval-check request by the device will receive the tokens.
  5. Digital Identity Management informs the portal that the approval is complete.
  6. The approval UI tells the user that their device should begin working shortly.
  7. As it has been doing repeatedly this whole time, the device calls the /oidc/token endpoint in the background to check for approval (see step 6 for details). This time, however, Digital Identity Management is going to respond with HTTP 200 OK.
  8. Digital Identity Management responds to the 10’/3m device with 200 OK and a JSON Object containing the requested tokens.
  9. The device must store the access token, ID token, and refresh token for future usage.
  10. The device informs the user that they are now logged in and may begin using the application.
Parent topic:Using Digital Identity Management for Single Sign-On