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

ctx.state.user 可以提取到JWT编码的data,这里的原理是什么? #64

Open
zhangxp426 opened this issue May 28, 2020 · 1 comment

Comments

@zhangxp426
Copy link

zhangxp426 commented May 28, 2020

ctx.state.user 可以提取到JWT编码的data,这里的原理是什么?

@zhangxp426 zhangxp426 changed the title ctx.state.user 可以提取到JWT编码的data,这里的原来是什么? ctx.state.user 可以提取到JWT编码的data,这里的原理是什么? May 28, 2020
@qq295823929
Copy link

不负责任猜想:jwt作为路由的中间件,先于实际请求的controller执行,解码之后,就直接给app.state.user赋值了,然后你就拿到了,这和你自己写一个路由中间件,在这个中间件里面给ctx里面挂东西是一样的

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