Poll for the access_token

Use the device_code and poll at the interval (in seconds) to check if the user has authorized you app. Use expires_in to stop polling after that many seconds, and gracefully instruct the user to restart the process. It is important to poll at the correct interval and also stop polling when expired.

When you receive a 200 success response, save the access_token so your app can authenticate the user in methods that require it. The access_token is valid for 7 days. Save and use the refresh_token to get a new access_token without asking the user to re-authenticate. Check below for all the error codes that you should handle.

JSON POST Data

KeyTypeValue
code *stringdevice_code from the initial method.
client_id *stringGet this from your app settings.
client_secret *stringGet this from your app settings.

Status Codes

This method will send various HTTP status codes that you should handle accordingly.

CodeDescription
200Success - save the access_token
400Pending - waiting for the user to authorize your app
404Not Found - invalid device_code
409Already Used - user already approved this code
410Expired - the tokens have expired, restart the process
418Denied - user explicitly denied this code
429Slow Down - your app is polling too quickly
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params

Body

string
required

The device code received from the device authorization request.

string
required

The client ID of the application.
You can find it in the application details here: https://trakt.tv/oauth/applications

string
required

The client secret of the application.
You can find it in the application details here: https://trakt.tv/oauth/applications

Responses

Language
Credentials
Header
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json