@pilotoo/web-auth
Introduction
Section titled “Introduction”@pilotoo/web-auth is the sign-in of the standalone services: Google OpenID Connect with PKCE, signed session cookies, personal access tokens and an identity guard. Two products on one database stay apart through the cookie names, token prefix and table names you give it. Pilotoo Connect and the Brain service both use it. Use it when your own NestJS product needs the same login; a host that already has one does not.
Installation
Section titled “Installation”@pilotoo/web-auth is at version 0.1.0, is marked private and is not published to a registry. It is also not part of the tarballs that pnpm release:check packs, so today it is used from the kit workspace:
pnpm installpnpm --filter @pilotoo/web-auth buildInside the workspace, depend on it with "@pilotoo/web-auth": "workspace:^". Its build first builds the kit packages it depends on.
Basic usage
Section titled “Basic usage”import { webAuthControllers, webAuthProviders } from '@pilotoo/web-auth';
@Module({ controllers: [...webAuthControllers], providers: [{ provide: POOL, useValue: pool }, ...webAuthProviders(options, { token: POOL, pool: (value: Pool) => value })],})export class AppModule {}Create the tables once at boot with createWebAuthTables. Shared sign-in lists every option.
Entry points
Section titled “Entry points”| Import | Provides |
|---|---|
@pilotoo/web-auth |
webAuthProviders, webAuthControllers, AuthController, LinkController, IdentityGuard, Anonymous, OidcClient, UserRepository, createWebAuthTables, GOOGLE_ISSUER, the cookie helpers, seal and open, and the option types. |
The link routes let another product obtain a personal token for a user who consents. They answer 404 unless linkClients is set.
Peer dependencies
Section titled “Peer dependencies”@nestjs/common and @nestjs/core (^11.2.3), reflect-metadata (^0.2.2) and rxjs (^7.8.2). It depends on pg.
Learn more
Section titled “Learn more”- Shared sign-in.
- Authentication for the kit’s own identity model.