Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

...

EndpointHTTP MethodPurpose
/api/auth/v1/devicePOSTCreates unique user code and a verification URI to present it on a external browser to verify the user.
/api/auth/v1/device/verifyPOSTVerifies the user code with the authenticated user.
/api/auth/v1/access_token grant_type="urn:ietf:params:oauth:grant-type:device_code"POSTProvides access_token to the device once the user is verified externally.

...

Now the device needs to display the URL and User Code to the user. While the device waits for the user to enter the code and log in, it will make a POST request every 5 seconds as specified by the interval returned. This POST request will be made to the /api/auth/v1/access_tokenendpoint, using a grant type of urn:ietf:params:oauth:grant-type:device_code

Code Block
POST https://authorization-server.com/token

grant_type=urn:ietf:params:oauth:grant-type:device_code
&client_id=CLIENT_ID
&device_code=NGU4QWFiNjQ5YmQwNG3YTdmZMEyNzQ3YzQ1YSA

...

Code Block
{
  "errors": [
    {
      "id": "6de7da3e-8877-4f2b-a670-16e18e5d79a0",
      "status": "202",
      "code": "0",
      "title": "Authentication Pending",
      "detail": " - User is not yet authenticated, try again."
    }
  ]
}

The authorization_pending error The Authentication Pending error means the user isn’t finished logging in, but the code hasn’t yet expired either. The device should try this again after the specified number of seconds. Meanwhile the user will be logging in, choosing a YouTube account, and approving the request.