@camunda8/sdk
    Preparing search index...

    Interface IHeadersProvider<T>

    An object that provides this interface is responsible for providing authentication headers to the SDK. The SDK will use the provided header(s) on requests to the Camunda 8 API endpoints.

    This interface is used by the SDK to support different authentication mechanisms, such as OAuth2, Basic Auth, and others. The SDK will call the getToken method to retrieve the authentication headers for a specific audience. The audience is a string that identifies the API endpoint that the SDK is trying to access.

    You can implement this interface to create a custom authentication provider that meets your specific needs. You could also use this interface to add any other headers that are required by your API endpoints.

    interface IHeadersProvider<T extends { [key: string]: string } = AuthHeader> {
        getHeaders(audience: TokenGrantAudienceType): Promise<T>;
        setToken(audience: TokenGrantAudienceType, token: string): Promise<void>;
    }

    Type Parameters

    Implemented by

    Index

    Methods

    • Called by the SDK to get the authentication headers for a specific audience. The audience is a string that identifies the API endpoint that the SDK is trying to access. The SDK will use the provided headers on requests to the Camunda 8 API endpoint.

      Parameters

      Returns Promise<T>

      A promise that resolves to an object containing the authentication headers.

    • This is an optional method that can be implemented by the provider to set the token for a specific audience. This method is useful for scenarios where the token needs to be set manually, such as when using a static bearer token or when managing the token lifecycle yourself.

      The SDK will not call this method automatically. It is up to the implementation or the consumer to call this method when the token needs to be set.

      Parameters

      Returns Promise<void>