Skip to content
Pilotoo
v0.1

@pilotoo/web-auth

@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.

@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:

Terminal window
pnpm install
pnpm --filter @pilotoo/web-auth build

Inside the workspace, depend on it with "@pilotoo/web-auth": "workspace:^". Its build first builds the kit packages it depends on.

src/app.module.ts
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.

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.

@nestjs/common and @nestjs/core (^11.2.3), reflect-metadata (^0.2.2) and rxjs (^7.8.2). It depends on pg.