Authorization Code + PKCE
Follows RFC 6749 and RFC 7636 with S256. Works for SPAs, mobile apps and backends.
Add the Authorization Code + PKCE flow to your app. Keep your own database, users and JWTs.
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:
| Method | Path | What it does |
|---|---|---|
| GET | /authorize | Checks the client and sends back a code |
| POST | /token | Swaps the code for an access token |
Install it from npm:
npm install @zaki-goumri-2/stampThen follow the getting started guide.