/device/code
POST
/device/code
const url = 'https://gymgym.club/api/auth/device/code';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"client_id":"example","user_id":"example","scope":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://gymgym.club/api/auth/device/code \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "client_id": "example", "user_id": "example", "scope": "example" }'Request a device and user code
Follow rfc8628#section-3.2
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
client_id
required
The client ID of the application
string
user_id
The user ID to which the device code should be pre-bound.
string
scope
Space-separated list of scopes
string
Examplegenerated
{ "client_id": "example", "user_id": "example", "scope": "example"}Responses
Section titled “Responses”Success
Media typeapplication/json
object
device_code
The device verification code
string
user_code
The user code to display
string
verification_uri
The URL for user verification. Defaults to /device if not configured.
string format: uri
verification_uri_complete
The complete URL with user code as query parameter.
string format: uri
expires_in
Lifetime in seconds of the device code
number
interval
Minimum polling interval in seconds
number
Examplegenerated
{ "device_code": "example", "user_code": "example", "verification_uri": "https://example.com", "verification_uri_complete": "https://example.com", "expires_in": 1, "interval": 1}Error response
Media typeapplication/json
object
error
string
error_description
string
Example
{ "error": "invalid_request"}Unauthorized. Due to missing or invalid authentication.
Media typeapplication/json
object
message
required
string
Examplegenerated
{ "message": "example"}Forbidden. You do not have permission to access this resource or to perform this action.
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}Not Found. The requested resource was not found.
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}Too Many Requests. You have exceeded the rate limit. Try again later.
Media typeapplication/json
object
message
string
Examplegenerated
{ "message": "example"}Server error
Media typeapplication/json
object
error
string
error_description
string
Example
{ "error": "server_error"}