The most basic token provider, which simply returns the token it was instantiated with.

Generally, anywhere this can be used in the public astra-db-ts interfaces, you may also pass in a plain string or null/undefined, which is transformed into a StaticTokenProvider under the hood.

Example

const provider = new StaticTokenProvider('token');
const client = new DataAPIClient(provider);

// or just

const client = new DataAPIClient('token');

See

TokenProvider

Hierarchy (view full)

Constructors

Properties

#token: string
opts: MonoidalOptionsHandler<Types>

Methods

  • Internal

    Parameters

    Returns ((token) => {
        Authorization?: undefined;
        Token: string;
    } | {
        Authorization: string;
        Token?: undefined;
    } | {
        Authorization?: undefined;
        Token?: undefined;
    })

      • (token): {
            Authorization?: undefined;
            Token: string;
        } | {
            Authorization: string;
            Token?: undefined;
        } | {
            Authorization?: undefined;
            Token?: undefined;
        }
      • Parameters

        • token: undefined | null | string

        Returns {
            Authorization?: undefined;
            Token: string;
        } | {
            Authorization: string;
            Token?: undefined;
        } | {
            Authorization?: undefined;
            Token?: undefined;
        }