• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: How to use chain of jwt strategies in NestJS?

Resolved: How to use chain of jwt strategies in NestJS?

0
By Isaac Tonny on 17/06/2022 Issue
Share
Facebook Twitter LinkedIn

Question:

In my nestjs project, I am trying to use multiple jwt strategies. Here is the jwt-auth.guard.ts:
jwt.strategy.ts:
sec.strategy.ts:
Auth.module.ts:
When I trying to use JwtAuthGuard in my code :
I can get the error:
Am I missing something here?

Answer:

In your sec.strategy.ts you need to give the strategy a custom name like so:
otherwise it will take on the default 'jwt' name. With the above, it’ll now have the name 'sec' and be properly registered with passport

If you have better answer, please add a comment about this, thank you!

authentication jwt nestjs node.js token
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: In a Pinescript v5 Strategy why is my bool not working?

02/04/2023

Resolved: net::ERR_HTTP2_PROTOCOL_ERROR by http get request angular 15.2

02/04/2023

Resolved: How do I stop the command from happening if the requirements for it to work aren’t sert Discord.js

02/04/2023

Leave A Reply

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.