Questions tagged [nestjs-jwt]

This package provides JSON Web Token (JWT) utilities and helps create tokens for use in authentication and authorization of web requests to your NestJS application. It contains a JwtModule that exposes a single JwtService provider to sign, verify and decode JWT tokens, either synchronously or asynchronously. The JwtService is configured with options (via JwtModuleOptions) that correspond to config of the NodeJS jsonwebtoken package used underneath.

Provides JWT utilities module for NestJS based on the jsonwebtoken package.

From the documentation:

The @nestjs/jwt package is a utility package that helps with JWT manipulation. The passport-jwt package is the Passport package that implements the JWT strategy and @types/passport-jwt provides the TypeScript type definitions.

From the project README.md:

Installation

$ npm i --save @nestjs/jwt

Usage

Import JwtModule:

@Module({
 imports: [JwtModule.register({ secret: 'hard!to-guess_secret' })],
 providers: [...],
})
export class AuthModule {}

Inject JwtService:

@Injectable()
export class AuthService {
 constructor(private readonly jwtService: JwtService) {}
}

More information

77 questions
0
votes
2 answers

Unable to retrieve dotenv JWT secret " Error: secretOrPrivateKey must have a value"

I am trying to secure my app by hiding the secret JWT key into a dotenv file stored locally at the root of the app, but the documentation isn't clear enough to me, and I keep getting this error when running the tests : console.error Error:…
A Mehmeto
  • 1,594
  • 3
  • 22
  • 37
-1
votes
1 answer

How can I see the list of JWT tokens generated(I`m using nestjs jwt)

Hello there I have an application that generates a JWT token for the user on logging in. But the problem is I want to add the previous JWTtoken to blacklist if the user logged in with a new device. The problem is I don`t know how to get the previous…
ADLZ
  • 75
  • 1
  • 4
1 2 3 4 5
6