Skip to content

AuthService

katanakit-js / AuthService

Defined in: core/services/auth.service.ts:91

Holds the providers a deployment has configured and routes a request to one.

A registry rather than a single global provider because “which one” is configuration: a municipality may resolve a national identity number while a SaaS resolves an OAuth session, and both ship as the same kit. Nothing here reaches the network — providers are injected, so the core stays pure and testable with a stub.

useHas(provider): boolean;

Defined in: core/services/auth.service.ts:117

Whether a provider id is registered.

Parameter Type
provider string

boolean


useProviders(): string[];

Defined in: core/services/auth.service.ts:122

Registered provider ids, in registration order.

string[]


useRegister(provider): void;

Defined in: core/services/auth.service.ts:112

Registers a provider, replacing any previous one with the same id.

Parameter Type
provider IAuthProvider

void


useResolve(provider, input): Promise<AuthResult<
| {
claims?: Record<string, unknown>;
email?: string;
emailVerified?: boolean;
method: string;
provider: string;
subject: string;
}
| null>>;

Defined in: core/services/auth.service.ts:138

Resolves the caller through the named provider.

An unknown provider id is a configuration failure, not an anonymous visitor — it returns ok: false so a typo cannot quietly turn a guarded route into a public one.

Parameter Type
provider string
input AuthRequestLike

Promise<AuthResult< | { claims?: Record<string, unknown>; email?: string; emailVerified?: boolean; method: string; provider: string; subject: string; } | null>>


useUnregister(provider): boolean;

Defined in: core/services/auth.service.ts:127

Removes a provider. Returns whether it was there.

Parameter Type
provider string

boolean


static create(): AuthService;

Defined in: core/services/auth.service.ts:107

A non-singleton instance, for tests or for isolating two deployments.

AuthService


static getInstance(): AuthService;

Defined in: core/services/auth.service.ts:101

The shared instance.

AuthService