Skip to content

Class: ServiceAuthClient

Class: ServiceAuthClient

Defined in: auth-server-nest/src/services/service-auth.client.ts:28

NestJS adapter around the framework-agnostic ServiceAuthClient from @vendidit/auth-server-ts. Thin façade — token caching + the client-credentials exchange live in the core class.

Implements OnModuleInit only to preserve the existing lifecycle hook shape (current impl is a deliberate no-op; first consumer call triggers the exchange). Boot stays fast; auth-server outage doesn’t prevent startup.

Provisioning: a platform admin creates the client via POST /admin/m2m-clients (system_admin only). The plaintext secret is returned exactly once on creation. Set the returned client_id + client_secret on AuthClientOptions.m2m.

Transitional fallback: when m2m config is absent, getToken() falls back to the AUTH_REGISTRATION_TOKEN env var (legacy bootstrap shim).

Implements

  • OnModuleInit

Constructors

Constructor

new ServiceAuthClient(opts): ServiceAuthClient

Defined in: auth-server-nest/src/services/service-auth.client.ts:32

Parameters

opts

AuthClientOptions

Returns

ServiceAuthClient

Methods

getToken()

getToken(): Promise<string>

Defined in: auth-server-nest/src/services/service-auth.client.ts:56

Returns

Promise<string>


invalidate()

invalidate(): void

Defined in: auth-server-nest/src/services/service-auth.client.ts:60

Returns

void


isConfigured()

isConfigured(): boolean

Defined in: auth-server-nest/src/services/service-auth.client.ts:52

Returns

boolean


onModuleInit()

onModuleInit(): void

Defined in: auth-server-nest/src/services/service-auth.client.ts:47

Returns

void

Implementation of

OnModuleInit.onModuleInit