Skip to main content

Integration Access Service

Gateway for third-party integration providers. Manages account provisioning, authentication token lifecycle, and API key management for external tools. Currently supports Langflow as the only provider, with an extensible registry pattern for adding more (GitHub, Jira, etc.).

  • Tech: NestJS 11
  • Port: 4000
  • Auth: JWT (RS256), API Key, Public
  • Database: None (in-memory token cache, user records persisted via user-service)

Integration Endpoints

MethodPathAuthDescription
GET/api/v1/integrations/providersPublicList all available integration provider names
POST/api/v1/integrations/:providerName/tokensJWTEnsure tokens exist for user + provider. Creates account, logs in, caches tokens.
POST/api/v1/integrations/:providerName/accountJWTEnsure account exists for user in provider
GET/api/v1/integrations/:providerName/healthPublicHealth check for a specific provider
GET/api/v1/integrations/healthPublicHealth check for all providers
GET/api/v1/healthPublicService health check
GET/metrics--Prometheus metrics

Langflow Endpoints

These endpoints are conditionally registered -- only available when LANGFLOW_BASE_URL and LANGFLOW_ADMIN_API_KEY are configured.

MethodPathAuthDescription
GET/api/v1/langflow/flowsJWTList all Langflow flows for the user
POST/api/v1/langflow/flowsJWTCreate a new flow
GET/api/v1/langflow/:flowIdJWTGet a specific flow
POST/api/v1/langflow/:flowId/runJWTExecute a flow with input
POST/api/v1/langflow/tokens/refreshJWTRefresh Langflow access token
GET/api/v1/langflow/healthPublicLangflow instance health check
GET/api/v1/langflow/api-keyJWTGet user's Langflow API key

Token Lifecycle

The ensureTokens flow for a provider:

  1. Check in-memory token cache for existing valid tokens
  2. If found but expired, try to refresh via the provider's refresh endpoint
  3. If refresh fails or no cached tokens, do a fresh login
  4. Cache the new tokens in memory
  5. Return the tokens to the caller

Tokens are stored in an in-memory mock database (planned migration to Redis). Lost on service restart.

Account Provisioning (Langflow)

The ensureAccount flow:

  1. Check user-service for existing Langflow account record
  2. If not found, create a new user in Langflow with a random password
  3. Activate the user in Langflow
  4. Create an API key in Langflow for the user
  5. Save all credentials (username, password, API key) to user-service

Inter-Service Communication

TargetProtocolPurpose
user-serviceHTTPGET /langflow-users/me -- Get Langflow account record
user-serviceHTTPPOST /langflow-users -- Create Langflow account record
user-serviceHTTPPATCH /langflow-users/:userId -- Update account (API key, etc.)
LangflowHTTPPOST /api/v1/login -- Login
LangflowHTTPPOST /api/v1/refresh -- Refresh token
LangflowHTTPPOST /api/v1/users/ -- Create user (admin API key)
LangflowHTTPPATCH /api/v1/users/:userId -- Activate user
LangflowHTTPGET /api/v1/flows/ -- List flows
LangflowHTTPPOST /api/v1/flows/ -- Create flow
LangflowHTTPGET /api/v1/flows/:flowId -- Get flow
LangflowHTTPPOST /api/v1/run/:flowId -- Run flow
LangflowHTTPPOST /api/v1/api_key/ -- Create API key
LangflowHTTPGET /health -- Health check

Key Environment Variables

VariableRequiredDescription
LANGFLOW_BASE_URLNoLangflow instance URL. If not set, Langflow module is disabled.
LANGFLOW_ADMIN_API_KEYNoAdmin API key for Langflow user management
USER_SERVICE_URLYesUser service base URL
USER_SERVICE_SECRETYesSecret for user-service calls