@nebius/js-sdk - v0.2.54
    Preparing search index...

    Class FileBearer

    Reads a fixed access token from a text file for every authentication fetch.

    The file must contain one non-empty line. Leading and trailing whitespace is removed. This bearer does not renew the token, but it sees file changes on later requests.

    import { SDK } from '@nebius/js-sdk';
    import { FileBearer } from '@nebius/js-sdk/runtime/token/file';

    const sdk = new SDK({
    credentials: new FileBearer('~/.config/my-app/token'),
    userAgentPrefix: 'example-application/1.0',
    });

    Hierarchy (View Summary)

    Indexable

    • [key: symbol]: () => unknown

      Reads a fixed access token from a text file for every authentication fetch.

      The file must contain one non-empty line. Leading and trailing whitespace is removed. This bearer does not renew the token, but it sees file changes on later requests.

        • (): unknown
        • Returns a JSON-safe value for logs.

          Returns unknown

    Index
    $type: "nebius.sdk.FileBearer" = 'nebius.sdk.FileBearer'

    Contains the fully qualified runtime type name.

    • get metricProvider(): string

      Returns the provider name for authorization metrics.

      Returns string

    • get name(): string | undefined

      Returns the stable credential name used by file-backed token caches.

      Most bearers do not have a name. Wrappers can add one with NamedBearer.

      Returns string | undefined

    • get wrapped(): Bearer | undefined

      Returns the next bearer in a wrapper chain, when this bearer wraps another source.

      Returns Bearer | undefined

    • Stops owned background work and closes the wrapped bearer.

      Parameters

      • OptionalgraceMs: number

      Returns Promise<void>

    • Reads and validates the current file contents.

      Rejects when the file is empty, contains an embedded newline, or cannot be read. The returned token has no known expiration.

      Returns Promise<Token>