No valid invalid token for verification
miyaohua opened this issue · 2 comments
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
I imported JwtModule and registered the register method in auth.module.ts, providing both the secret and signOptions. In auth.service.ts, I wrote the getToken method and called the jwtService's sign method. According to the documentation provided on the official website, I only provided one payload parameter, but it prompted me to have a secret. Therefore, I passed a configuration object containing the secret, which has returned the token normally, but it cannot verify invalid tokens. Therefore, I added a payload parameter to the object of the second parameter of the sign method. ExpiresIn, it can now be executed. May I ask if it is possible not to register the register method in auth.module.ts?
Minimum reproduction code
1
Steps to reproduce
No response
Expected behavior
I imported JwtModule and registered the register method in auth.module.ts, providing both the secret and signOptions. In auth.service.ts, I wrote the getToken method and called the jwtService's sign method. According to the documentation provided on the official website, I only provided one payload parameter, but it prompted me to have a secret. Therefore, I passed a configuration object containing the secret, which has returned the token normally, but it cannot verify invalid tokens. Therefore, I added a payload parameter to the object of the second parameter of the sign method. ExpiresIn, it can now be executed. May I ask if it is possible not to register the register method in auth.module.ts?
Package version
10.2.0
NestJS version
10.0.0
Node.js version
16.20.2
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
Please provide a minimum reproduction repository. You can start one by running npm init nest
in your terminal
why reproductions are required
Thank you for taking the time to submit your report! From the looks of it, this could be better discussed on our Discord. If you haven't already, please join here and send a new post in the # 🐈 nestjs-help forum. Make sure to include a link to this issue, so you don't need to write it all again. We have a large community of helpful members, who will assist you in getting this to work.