-
-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unknown authentication strategy "jwt" when use Request Scope Service #1870
Comments
You are not lone here, I also had the same issue. I don't have a solution, i have been playing around with it for hours and no go. |
You cannot use request scoped providers in passport strategy because passport itself is global (the package is not compatible with this feature). Hopefully, we will provide a more flexible |
Is a more flexible |
I was so excited i could make a logger scoped with the request .... only to be extremely disappointed. Have a stack question open if anyone wants to chime in https://stackoverflow.com/questions/57714282/log-session-user-nodejs-nestjs |
Documentation at https://docs.nestjs.com/techniques/authentication should probably be updated to make this issue clear. |
What are some of the workarounds people have come up with? I was wondering if using a middleware instead of using provider scope works as a workaround? Update: @eropple/nestjs-auth exists, and it uses interceptors, as opposed to middleware. |
@yaser-ali-s .. .made 2 loggers with different scopes and manually passed in the request where appropriate
|
Any news on this one ? Any service dependent on Request scope will break the passport. |
Any news? |
This is not a bug. You cannot use request scoped providers in passport strategy because passport itself is global (the package is not compatible with this feature). Hopefully, we will provide a more flexible @nestjs/auth package soon. |
I'm submitting a...
Current behavior
When i import in
JwtStrategy
aservice
that hasRequest 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
The text was updated successfully, but these errors were encountered: