UNPKG

@camunda8/sdk

Version:

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

35 lines (34 loc) 1.45 kB
import got from 'got'; import { CamundaPlatform8Configuration, DeepPartial } from '../../lib'; import { IHeadersProvider } from '../index'; import { TokenGrantAudienceType } from './IHeadersProvider'; /** * The `CookieAuthProvider` is an implementation of {@link IHeadersProvider} that * supports the [authentication used in C8run 8.7](https://docs.camunda.io/docs/apis-tools/camunda-api-rest/camunda-api-rest-authentication/#authentication-via-cookie-c8run-only). * It retrieves a cookie from the C8run login endpoint, and passes it in the * `cookie` header for subsequent requests. * * It does not handle token expiration or renewal. The cookie may be reset * manually by calling the `setToken` method. */ export declare class CookieAuthProvider implements IHeadersProvider { rest: Promise<typeof got>; cookie?: string; username: string; password: string; authUrl: string; constructor(options?: { config?: DeepPartial<CamundaPlatform8Configuration>; }); getHeaders(audienceType: TokenGrantAudienceType): Promise<{ cookie: string; }>; /** * Forces a new login by resetting the cookie. * This method is useful for scenarios where the cookie has expired * or when you want to refresh the authentication. * It will reset the cookie to undefined, which will trigger a new login * the next time the getToken method is called. */ setToken(): Promise<void>; }