postToken
function postToken( host, url, params, opts): Promise<Record<string, unknown>>;Defined in: core/src/auth/oauth.ts:143
POST to a token endpoint and return the parsed body.
A token in the body wins over the status: a vendor can return a usable
credential next to a non-2xx (Anthropic answers 429 for a plan over its usage
limit). Only a body without one is an error. The device-code poll sets
allowErrorBody, because it gets a 4xx for most of the wait.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
host |
AuthHost |
url |
string |
params |
Record<string, string | boolean> |
opts |
{ allowErrorBody?: boolean; encode: "json" | "form"; } |
opts.allowErrorBody? |
boolean |
opts.encode |
"json" | "form" |
Returns
Section titled “Returns”Promise<Record<string, unknown>>