Skip to content

/device/code

POST
/device/code
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

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"
}

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
Allowed values: invalid_request invalid_client unauthorized_client invalid_scope
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
Allowed values: server_error
error_description
string
Example
{
"error": "server_error"
}