Skip to Content

Authentifizierung

Der Client unterstützt verschiedene Authentifizierungsarten.

Statischer Token

import { EngineClient, Identity } from '@5minds/processcube_engine_client'; const identity: Identity = { token: 'Bearer my-jwt-token', userId: 'user123' }; const client = new EngineClient('http://localhost:10560', identity);

Dynamischer Token (Callback)

import { EngineClient } from '@5minds/processcube_engine_client'; const client = new EngineClient('http://localhost:10560', async () => { const token = await fetchTokenFromAuthProvider(); return { token, userId: 'user123' }; });

Client Credentials (OAuth2)

import { EngineClient, ClientCredentialsConfig } from '@5minds/processcube_engine_client'; const credentials: ClientCredentialsConfig = { clientId: 'my-client-id', clientSecret: 'my-client-secret', authority: 'https://auth.example.com', scope: 'engine', }; const client = new EngineClient('http://localhost:10560', credentials);

Bei dynamischen Tokens und Client Credentials wird der Token automatisch vor Ablauf erneuert.