Abstract
Abstract
getThe function which provides the token. It may do any I/O as it wishes to obtain/refresh the token, as it's called every time the token is required for use, whether it be for the Data API, or the DevOps API.
Static
mergeInternal
Turns a string token into a StaticTokenProvider if necessary. Throws an error if
it's not a string, nullish, or a TokenProvider
already.
Not intended for external use.
Rest
...raw: (string | nullish | TokenProvider)[]
The base class for some "token provider", a general concept for anything that provides some token to the client, whether it be a static token, or if the token is dynamically fetched at runtime, or periodically refreshed.
The TokenProvider.getToken function is called any time the token is required, whether it be for the Data API, or the DevOps API.
astra-db-ts
provides all the main token providers you may ever need to use, but you're able to extend this class to create your own if you find it necessary.Generally, where you can pass in a
TokenProvider
, you may also pass in a plain string which is translated into a StaticTokenProvider under the hood.Example
See