Skip to content

Interface: AuthOptions ​

Defined in: api/rust-fetch.d.ts:220

Properties ​

basic? ​

optional basic?: object

Defined in: api/rust-fetch.d.ts:224

Authorization: Basic … instead of a bearer token

password ​

password: string

username ​

username: string


bearer? ​

optional bearer?: string | (() => string | Promise<string | undefined> | undefined)

Defined in: api/rust-fetch.d.ts:222

Authorization: Bearer … on every request to the client's origin: a token, or a function returning one (sync or async), called for each request


origins? ​

optional origins?: string[]

Defined in: api/rust-fetch.d.ts:228

Other origins that may receive the credentials, such as https://uploads.example.com. The origin of baseUrl always may; no other origin ever does.


refresh? ​

optional refresh?: () => void | Promise<void>

Defined in: api/rust-fetch.d.ts:226

Called when a request gets 401: once for all requests failing at the same time (single flight). Each failed request is then replayed once with the new token (not requests with a stream body); a second 401 rejects with the HttpError. If it rejects, the HttpError is thrown with the failure as cause. Needs bearer.

Returns ​

void | Promise<void>

Released under the MIT or Apache-2.0 license.