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

    Provides automatically renewed access tokens for a service account.

    This is the main service-account credential for the SDK. It signs a short-lived assertion, exchanges it for an access token, keeps the access token in memory, and renews it before expiration.

    import { SDK } from '@nebius/js-sdk';

    // Raw service-account values let SDK create and connect the exchange flow.
    const sdk = new SDK({
    credentials: {
    serviceAccountId: process.env.NEBIUS_SERVICE_ACCOUNT_ID ?? '',
    privateKeyPem: process.env.NEBIUS_PRIVATE_KEY_PEM ?? '',
    publicKeyId: process.env.NEBIUS_PUBLIC_KEY_ID ?? '',
    },
    userAgentPrefix: 'example-application/1.0',
    });

    Close the SDK during shutdown. This stops the renewal timer.

    Hierarchy (View Summary)

    Indexable

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

      Provides automatically renewed access tokens for a service account.

      This is the main service-account credential for the SDK. It signs a short-lived assertion, exchanges it for an access token, keeps the access token in memory, and renews it before expiration.

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

          Returns unknown

    Index
    • Creates renewable service-account credentials.

      serviceAccount can be a reader, a complete ServiceAccount, or a service account ID. When it is an ID, privateKeyPem and publicKeyId are required. Do not supply these two options for the other input forms.

      Parameters

      • serviceAccount: string | ServiceAccount | Reader
      • Optionalopts: {
            initialRetryTimeoutMs?: number;
            lifetimeSafeFraction?: number;
            logger?: Logger;
            maxRetries?: number;
            maxRetryTimeoutMs?: number;
            metrics?: AuthMetricsInput;
            privateKeyPem?: string;
            publicKeyId?: string;
            refreshRequestTimeoutMs?: number;
            retryTimeoutExponent?: number;
            sdk?: SDKInterface | Promise<SDKInterface> | null;
        }
        • OptionalinitialRetryTimeoutMs?: number

          Initial renewal backoff, in milliseconds.

        • OptionallifetimeSafeFraction?: number

          Fraction of token lifetime to wait before proactive renewal.

        • Optionallogger?: Logger

          Optional destination for diagnostic events.

        • OptionalmaxRetries?: number

          Maximum total authentication attempts for one receiver. Defaults to 2.

        • OptionalmaxRetryTimeoutMs?: number

          Maximum renewal backoff, in milliseconds.

        • Optionalmetrics?: AuthMetricsInput

          Optional authentication metrics destination.

        • OptionalprivateKeyPem?: string

          PEM private key. Required only when serviceAccount is an ID string.

        • OptionalpublicKeyId?: string

          Registered public-key ID. Required only when serviceAccount is an ID string.

        • OptionalrefreshRequestTimeoutMs?: number

          Default token-exchange request budget, in milliseconds.

          It applies to foreground and background renewal when the caller does not supply a synchronous override.

        • OptionalretryTimeoutExponent?: number

          Multiplier for exponential renewal backoff.

        • Optionalsdk?: SDKInterface | Promise<SDKInterface> | null

          SDK used for the token-exchange RPC.

          Required for a prebuilt bearer. As an easier alternative, pass raw service-account values to new SDK({ credentials: ... }).

      Returns ServiceAccountBearer

    $type: "nebius.sdk.ServiceAccountBearer" = 'nebius.sdk.ServiceAccountBearer'

    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

    • Stops owned background work and closes the wrapped bearer.

      Parameters

      • OptionalgraceMs: number

      Returns Promise<void>