oauth

Handles `POST /device_authorization` — the RFC 8628 device authorization endpoint.

Changed on

Public, form-encoded, no session required (rate-limited like /token). Validates the client, checks it is allowed the device-code grant, validates requested scopes against the client's registered scopes, then issues an opaque device_code (stored only as an HMAC digest) plus a human-typable user_code.

Follows RFC 8628 §3.1–§3.2.

Example

POST /api/v0/main-frontend/oauth/device_authorization HTTP/1.1
Content-Type: application/x-www-form-urlencoded

client_id=tmc-vscode&scope=exercise-services

Successful response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "device_code": "GmRhmhcxhwAzkoEqiMEg_DnyEysNkuNhszIySk9eS",
  "user_code": "WDJB-MJHT",
  "verification_uri": "https://courses.mooc.fi/oauth_device",
  "verification_uri_complete": "https://courses.mooc.fi/oauth_device?user_code=WDJB-MJHT",
  "expires_in": 900,
  "interval": 5
}
post/api/v0/main-frontend/oauth/device_authorization

Request

  • The document declares no server URL.
  • Auth: none declared

Response

Device authorization response

device_codestring required
expires_ininteger required
intervalinteger required
user_codestring required
verification_uristring required
verification_uri_completestring required

Changes