01 Device code (OAuth 2.0 device authorization grant) (1/2)

The reader shows a QR code + user code. The user approves on their phone, and the reader polls until a token comes back.

  "auth": {
    "type": "device_code",       // the default
    "request": { "url": "https://auth.example.com/device/code", "method": "POST",
                 "headers": { "Content-Type": "application/x-www-form-urlencoded" },
                 "body": "client_id=my-reader&scope=library" },
    "poll":    { "url": "https://auth.example.com/token", "method": "POST",
                 "headers": { "Content-Type": "application/x-www-form-urlencoded" },
                 "body": "grant_type=urn:ietf:params:oauth:grant-type:device_code&client_id=my-reader&device_code={device_code}" },
    // response paths (these are the defaults):
    "code_path": "user_code", "verify_url_path": "verification_uri",
    "device_code_path": "device_code", "interval_path": "interval",
    "expires_path": "expires_in", "token_path": "access_token", "error_path": "error"
  }
Reader file (.txt)Next ›