Skip to content
rw3iss Auth

ServiceAuthClient

ServiceAuthClient

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

NestJS adapter around the framework-agnostic ServiceAuthClient from @rw3iss/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: src/services/service-auth.client.ts:32

Parameters

opts

AuthClientOptions

Returns

ServiceAuthClient

Methods

getToken()

getToken(): Promise<string>

Defined in: src/services/service-auth.client.ts:51

Returns

Promise<string>


invalidate()

invalidate(): void

Defined in: src/services/service-auth.client.ts:55

Returns

void


isConfigured()

isConfigured(): boolean

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

Returns

boolean


onModuleInit()

onModuleInit(): void

Defined in: src/services/service-auth.client.ts:42

Returns

void

Implementation of

OnModuleInit.onModuleInit