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

    Adds in-memory renewal to ImpersonatedBearer.

    Use this variant for normal SDK requests so repeated calls reuse the impersonated access token until renewal is required.

    import { SDK } from '@nebius/js-sdk';
    import { CachedImpersonatedBearer } from '@nebius/js-sdk/runtime/token/impersonated';
    import { EnvBearer } from '@nebius/js-sdk/runtime/token/static';

    // This SDK makes the unauthenticated token-exchange RPC.
    const exchangeSdk = new SDK({
    userAgentPrefix: 'example-application/1.0',
    });
    const credentials = new CachedImpersonatedBearer(
    'serviceaccount-e00example',
    new EnvBearer(),
    exchangeSdk,
    );
    const sdk = new SDK({
    credentials,
    userAgentPrefix: 'example-application/1.0',
    });

    try {
    // Use sdk clients here.
    } finally {
    await sdk.close();
    await exchangeSdk.close();
    }

    Hierarchy (View Summary)

    • Bearer
      • CachedImpersonatedBearer
    Index
    • Creates a new cached impersonated bearer.

      Parameters

      • serviceAccountId: string
      • source: Bearer
      • sdk: SDKInterface | Promise<SDKInterface> | null
      • Optionalopts: {
            logger?: Logger;
            maxRetries?: number;
            metrics?: AuthMetricsInput;
            refreshRequestTimeoutMs?: number | null;
        }
        • Optionallogger?: Logger

          Optional destination for diagnostic events.

        • OptionalmaxRetries?: number

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

        • Optionalmetrics?: AuthMetricsInput

          Optional authentication metrics destination.

        • OptionalrefreshRequestTimeoutMs?: number | null

          Total actor and exchange budget, in milliseconds. The default null uses the composed source budget, or five seconds. Explicit zero and negative values stay unchanged.

      Returns CachedImpersonatedBearer

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

    Contains the fully qualified runtime type name.

    • get acquisitionBudgetMs(): number | undefined

      Returns the acquisition budget of the cached bearer chain.

      Returns number | undefined

    • get metricProvider(): string

      Returns the provider name for authorization metrics.

      Returns string

    • Stops owned background work and closes the wrapped bearer.

      Parameters

      • OptionalgraceMs: number

      Returns Promise<void>