Skip to content
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

为什么在ExecutionContext中无user? #1

Closed
icemanpro opened this issue Jun 11, 2020 · 1 comment
Closed

为什么在ExecutionContext中无user? #1

icemanpro opened this issue Jun 11, 2020 · 1 comment

Comments

@icemanpro
Copy link

在example内的usernameFromContext函数可取到request.user,但在我自己的程序中request.user是未定义的,我想问下,是哪里没设置对?

@dreamdevil00
Copy link
Contributor

https://docs.nestjs.com/techniques/authentication#implementing-passport-jwt

For the jwt-strategy, Passport first verifies the JWT's signature and decodes the JSON. It then invokes our validate() method passing the decoded JSON as its single parameter. 

Recall again that Passport will build a user object based on the return value of our validate() method, and attach it as a property on the Request object.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants