Notice
Recent Posts
Recent Comments
Link
«   2025/04   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30
Archives
Today
Total
관리 메뉴

NOT FOUND

nest js jwt error : secretOrPrivateKey must have a value 본문

nest js

nest js jwt error : secretOrPrivateKey must have a value

신토불이 2022. 9. 21. 11:47

https://docs.nestjs.com/security/authentication#login-route

 

Documentation | NestJS - A progressive Node.js framework

Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Progamming), FP (Functional Programming), and FRP (Functional Reac

docs.nestjs.com

nest js JWT Document를 보고 Token 생성 로직을 따라 했다

 

token: this.jwtService.sign(payload)

이 부분에서 오류가 난다

 

[Nest] 5520  - 2022. 09. 21. 오전 11:43:52   ERROR [ExceptionsHandler] secretOrPrivateKey must have a value
Error: secretOrPrivateKey must have a value
    at Object.module.exports [as sign] (C:\Users\lje0818\Desktop\git\conduit\realworld-ex\node_modules\jsonwebtoken\sign.js:107:20)

 

secretOrPrivateKey가 없다는 오류

위를 따라가보면 secretOrPrivateKey가 없다는 오류가 어디서 발생하는지를 알 수 있다

 

token: this.jwtService.sign(payload, {
	secret: jwtConstants.secret
})

secret을 추가해주고 해결

'nest js' 카테고리의 다른 글

class-validator nullable에 사용할 때 주의할 점  (0) 2023.10.27