@oxia-db/client - v0.1.0
    Preparing search index...

    Class TokenAuthentication

    Bearer-token authentication. Emits an authorization: Bearer <token> metadata header. The token can be a static string or a (sync or async) callable invoked on every RPC — useful for rotating credentials without reconnecting.

    new TokenAuthentication('my-static-token');
    new TokenAuthentication(async () => await fetchTokenFromIdp());

    Implements

    Index

    Constructors

    Methods

    Constructors

    • Parameters

      • token: string | (() => string | Promise<string>)

        A static bearer token, or a zero-argument callable (sync or async) that returns the current bearer token. The callable is invoked on every RPC.

      Returns TokenAuthentication

    Methods

    • Produce the authorization metadata header for the next RPC by resolving the token supplier.

      Returns Promise<Record<string, string>>