Authenticating devices with the Device Authorization Grant
PingOne PingOne Advanced Identity Cloud PingAM Android iOS
The Orchestration SDK implements the OAuth 2.0 Device Authorization Grant (RFC 8628) that lets you authenticate users on devices that have limited input capabilities or no embedded browser, such as smart TVs, IoT devices, or lobby kiosks.
The flow involves two devices:
- The requesting device
-
The constrained device running your app. It starts the flow, displays the code, and polls the server until it receives tokens.
- The approving device
-
A browser-capable device, such as the user’s phone or computer, where the user navigates to the authorization server and authenticates.
The app on the requesting device obtains a short-lived code from the authorization server, displays it to the user, and polls in the background while the user completes authentication on the separate, browser-capable approving device.
The overall authentication flow is as follows:
-
The requesting app calls
OidcDeviceClient.deviceAuthorization(), causing the Orchestration SDK to send aPOSTrequest to the device authorization endpoint. -
The server returns a
device_code, a short human-readableuser_code, averification_uri, an optionalverification_uri_completeparameter, and a pollinginterval.The requesting app now displays the
user_codeandverification_urito the user, so they can complete authentication on a separate, more capable device.Options for displaying the values include:
-
Plain text, so the user can visit the URL and type the code manually.
-
A QR Code the user can scan that has the URI, and the user code as a query parameter. When the user scans it on the approving device, the browser opens the authorization server’s UI with the code pre-filled, so the user does not need to type it.
-
-
The requesting app begins polling the server’s token endpoint, including the
device_code, to check if the authentication has been completed. -
The server returns
authorization_pending, indicating the user has not yet authenticated. The requesting app waits for theintervalduration and polls again. -
On the approving device, the user navigates to the
verification_uriand enters theuser_code. -
The authorization server starts an authentication journey or DaVinci flow.
-
The user completes authentication on the approving device, stepping through the journey or flow.
-
On successful authentication, the server updates the status for the relevant
device_code. -
The requesting app is still polling the token endpoint with the
device_code. -
This time, the server returns an
access_token,id_token, and optionalrefresh_token. Authentication is complete.