Skip to content

StampOAuth 2.0 for NestJS

Add the Authorization Code + PKCE flow to your app. Keep your own database, users and JWTs.

Quick look ​

ts
import { Module } from "@nestjs/common";
import { StampModule } from "@zaki-goumri-2/stamp";

@Module({
  imports: [
    StampModule.forRootAsync({
      imports: [StoresModule],
      clientStore: ClientStore,
      codeStore: CodeStore,
      jwtSigner: TokenSigner,
      loginPagePath: "/auth/login",
      resolveUserId: (req) => req.user?.id,
    }),
  ],
})
export class AppModule {}

Your app now has:

MethodPathWhat it does
GET/authorizeChecks the client and sends back a code
POST/tokenSwaps the code for an access token

Install ​

Install it from npm:

bash
npm install @zaki-goumri-2/stamp

Then follow the getting started guide.