Try Device Authorization Grant¶
The Device Authorization Grant is one of the grant types in the OAuth 2.0 specification. For more information about this grant type, see Device Authorization Grant.
Before you begin
You must first set up the
Device Flow Demo App sample webapp.
in order to try the following scenario.
/bin and start the server by executing the following command on a terminal window.
Access the [WSO2 Identity Server Management Console] (https://localhost:9443/carbon) and log in using your user name and password.
On the Main menu, click Users and Roles > Add.
Then click Add New User.
On the Main menu, click Service Providers > Add.
Enter the Service Provider Name and click Register.
Expand Inbound Authentication Configuration and then expand OAuth/OpenID Connect Configuration. Click Configure.
urn:ietf:params:oauth:grant-type:device_codeto enable using the device flow grant type.
Since these are public clients, ensure that the Allow authentication without the client secret checkbox is selected.
Next, click Update to save the service provider configurations. Take a note of the OAuth client key and client secret generated.
On your device (i.e., the demo app), configure the client ID as your OAuth client-key.
- Start the demo app.
- Now, click Login. This device will send a request to the /device_authorize endpoint along with its client ID.
Access the provided verification URI on your secondary device. You can either enter the user code there or scan the provided QR code. The QR code contains the complete verification URI(verification URI + user code).
Click Sign In. If the user code is correct, you will be prompted to enter your credentials. If you have entered the wrong user code or an expired(a user code is for one-time use) one, you will be prompted to re-enter your user code. In that case get a new user code and enter that along with your credentials.
You will be redirected to the device flow success page. Note that you are now successfully logged in to the service provider and you are instructed to close the browser.
On you demo app, you will see the following screen
To see the device authorization response and token response, navigate to the Developer tab. To validate your token , use the introspection endpoint. For more details, see Invoke the OAuth Introspection Endpoint.Top