UNPKG

@camunda8/sdk

Version:

[![NPM](https://nodei.co/npm/@camunda8/sdk.png)](https://www.npmjs.com/package/@camunda8/sdk)

42 lines (41 loc) 1.63 kB
import { CamundaPlatform8Configuration, DeepPartial } from '../../lib'; import { IHeadersProvider } from '../index'; import { TokenGrantAudienceType } from './IHeadersProvider'; /** * The `BearerAuthProvider` class is an implementation of {@link IHeadersProvider} * that uses a bearer token for authentication. This class is * responsible for providing the authentication headers to the SDK. Note that it does * not handle token expiration or renewal. The token must be set manually using the * `setToken` method. Nor does it handle token retrieval. The token must be provided * in the configuration object or set manually using the `setToken` method. * * This class is useful for scenarios where you have a static bearer token that * does not expire or where you want to manage the token lifecycle yourself. * * @example * ```typescript * const authProvider = new BearerAuthProvider({ * config: { * CAMUNDA_OAUTH_TOKEN: 'your-bearer-token', * }, * }) * * authProvider.setToken('newTokenValue') * ``` */ export declare class BearerAuthProvider implements IHeadersProvider { protected bearerToken: string; constructor(options?: { config?: DeepPartial<CamundaPlatform8Configuration>; }); getHeaders(audienceType: TokenGrantAudienceType): Promise<{ authorization: string; }>; /** * Updates the bearer token used for authentication. * * @param bearerToken - The new bearer token to be used. This should be a valid * token string obtained from a trusted source. */ setToken(bearerToken: string): Promise<void>; }