Unknown authentication strategy "jwt" when use Request Scope Service

See original GitHub issue

I’m submitting a…


[ ] Regression 
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

When i import in JwtStrategy a service that has Request Scope, authentication does not work anymore, as i show in this repository: https://github.com/victorschinaider/nest-request-auth-bug.

Expected behavior

I expect that i can use request scope service in JwtStrategy.

Minimal reproduction of the problem with instructions

In repository: https://github.com/victorschinaider/nest-request-auth-bug

What is the motivation / use case for changing the behavior?

Environment


Nest version: 6.0.0

 
For Tooling issues:
- Node version: 11
- Platform:  Ubuntu

Others:

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
marcus-sacommented, Jul 10, 2019

Is a more flexible @nestjs/auth package on the roadmap? @kamilmysliwiec Had to do some annoying workarounds with middleware and request context to get this working 💯

2reactions
nurikabecommented, Nov 16, 2019

Documentation at https://docs.nestjs.com/techniques/authentication should probably be updated to make this issue clear.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I tried to add request scope in to provider but it will give Error
mongoose - I tried to add request scope in to provider but it will give Error: Unknown authentication strategy "jwt" - Stack Overflow....
Read more >
Unknown authentication strategy "jwt" when I inject ... - Reddit
I have a user service that handles registration and login. But each time I inject another servie I get "Unknown authentication strategy "jwt"....
Read more >
Unknown authentication strategy "jwt" nestjs - You.com
Coming back to this answer about a year and a half later, it looks like the real issue is the use of a...
Read more >
Authentication | NestJS - A progressive Node.js framework
ignoreExpiration : just to be explicit, we choose the default false setting, which delegates the responsibility of ensuring that a JWT has not...
Read more >
Nest.js Step-by-Step: Part 3 (Users and Authentication)
What actually happens is that the JWT Strategy extracts the token and validates it. If the token is invalid, the current Request is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found