Poll a sign-in
/auth/tokenChecks whether the person has approved a sign-in, and returns the new API key once they have. It is the second half of the sign-in that Start a sign-in begins.
Scope | Heavy call | Long poll | CLI |
|---|---|---|---|
None, no key | No | No |
|
Guidance
Poll every
intervalseconds from Start a sign-in. Until the person decides, the answer is400in the usual error envelope:authorization_pendingmeans keep polling, andslow_downmeans this poll came less than about 2.5 seconds after the last, so wait longer (the CLI adds 2 seconds each time).Stop on
access_denied, which means the person refused, and onexpired_token, which means the sign-in expired, was already used or never existed. Start again only afterexpired_token.The key in the
200answer is shown this once. Store it before you do anything else, somewhere only the person can read.The new key has every scope and expires at
expires_at. That can be sooner than theexpires_in_daysyou asked for, since the person approving can shorten it. After it, every call answers401 unauthorizedwith API token expired., and the person signs in again. It is listed with the person's other keys on the Developers page, where they can revoke it.A sign-in is used up once it hands over a key: a later poll answers
expired_token.An account can hold 20 keys. At that limit the approval cannot create one, and the poll answers
500 internal. Revoke an old key on the Developers page and sign in again.The CLI keeps polling through
429and5xxanswers untilexpires_inruns out, then tells the person to sign in again.
Request body
Up to 4 KB.
Field | Type | Required | Description |
|---|---|---|---|
| string | Yes | The |
Response
200 once approved, with Cache-Control: no-store:
Field | Type | Description |
|---|---|---|
| string | The new key, |
| string | The key's name: CLI on followed by the |
| string | When the key stops working, RFC 3339 |
| integer | The key's life in days: 7, 30 or 90 |
Status codes
Status | Code | Meaning |
|---|---|---|
| - | Approved. The body has the new key |
|
| Not approved yet. Keep polling |
|
| Polling too fast. Wait longer |
|
| The person refused. Stop |
|
| Expired, already used or unknown. Start again |
|
| The body is not JSON or has no |
|
| Browser sign-in is unavailable |
|
| The key could not be created, for example because the account already has 20 keys |
