Installation
Requirements
- NestJS 10 or 11 (
@nestjs/common,@nestjs/core) - Node.js >= 18
- An Authgear application with “Issue JWT as access token” enabled
Install the package
@authgear/nestjs relies on jose for JWT and
JWKS handling, so install it alongside the SDK:
npm install @authgear/nestjs joseEnable JWT access tokens in Authgear
This SDK validates JWT access tokens offline. Opaque tokens are not supported. Enable JWT access tokens before writing any code:
- Open your project in the Authgear Portal .
- Go to Applications and select the OAuth client your API clients use.
- Turn on Issue JWT as access token.
- Click Save.
Tokens issued after this change are signed JWTs that @authgear/nestjs can
verify locally using your project’s JWKS.
Next steps
- Configuration — register
AuthgearModule - Protecting routes — apply the guard
Last updated on