Initialize device authorization flow
Start the OAuth2 Device Authorization flow for CLI/server-side applications.
Responses
Device code response application/json
device_codestringrequired
The device verification code
user_codestringrequired
The code displayed to the user
verification_uristring · urirequired
The URL where the user should enter the user_code
verification_uri_completestring · uri
The verification URL with the code included
expires_inintegerrequired
The lifetime of the device code in seconds
intervalintegerrequired
Minimum polling interval in seconds
{ "device_code": "string", "user_code": "string", "verification_uri": "https://example.com", "verification_uri_complete": "https://example.com", "expires_in": 0, "interval": 0}
Error response application/json
errorstring
― invalid_request
― unauthorized_client
― access_denied
― invalid_scope
error_descriptionstring
{ "error": "invalid_request", "error_description": "string"}
Body application/x-www-form-urlencoded
client_id string Required
scope string Required
Example
profile offline_access openid
audience string Required
Example
https://api.yotoplay.com
POST
/oauth/device/code
Server URL: https://api.yotoplay.com
Authorization (bearerAuth)
Request Body
curl "https://api.yotoplay.com/oauth/device/code"--header "Authorization: Bearer [YOUR_TOKEN]"
const options = { method: 'POST', headers: { 'Authorization': 'Bearer [YOUR_TOKEN]' }};
fetch('https://api.yotoplay.com/oauth/device/code', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://api.yotoplay.com/oauth/device/code", CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => "", CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_HTTPHEADER => [ "Authorization: Bearer [YOUR_TOKEN]" ],]);
$response = curl_exec($curl);$err = curl_error($curl);
curl_close($curl);
if ($err) { echo "cURL Error #:" . $err;} else { echo $response;}
import requests
url = "https://api.yotoplay.com/oauth/device/code"
headers = { "Authorization": "Bearer [YOUR_TOKEN]"}
response = requests.request("POST", url, headers=headers)
print(response.text)