Start a device sign-in
const url = 'http://localhost:8080/api/auth/device/code';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"host":"example","purpose":"login"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/auth/device/code \ --header 'Content-Type: application/json' \ --data '{ "host": "example", "purpose": "login" }'Issues a device code for cetra login or cetra-cli init (RFC 8628, D-AO-3). The CLI shows user_code, opens verification_uri_complete and polls POST /api/auth/device/token every interval seconds. The codes expire after expires_in seconds. No cookie and no Origin are needed. Ten codes a minute per client network (an IPv6 address counts by its /64); over that is 429.
Request Bodyrequired
Section titled “Request Bodyrequired”POST /api/auth/device/code body.
object
The machine’s name as the CLI reports it. Shown on the approval page.
What the code is for.
Responses
Section titled “Responses”The codes, the approval page’s URLs and the polling interval.
POST /api/auth/device/code answer. Debug prints device_code as <redacted>.
object
The secret the CLI polls with. Shown only in this answer.
Seconds until the code expires.
Seconds between polls.
The code the user types, XXXX-XXXX.
The approval page, without the code.
The approval page with the code filled in.
Example generated
{ "device_code": "example", "expires_in": 1, "interval": 1, "user_code": "example", "verification_uri": "example", "verification_uri_complete": "example"}The request is malformed or a filter is invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}Too many requests.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The server is busy or a dependency is unavailable. Retry later.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}