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

关于存读token的问题 #4

Open
wuyushuooo opened this issue Oct 7, 2017 · 1 comment
Open

关于存读token的问题 #4

wuyushuooo opened this issue Oct 7, 2017 · 1 comment

Comments

@wuyushuooo
Copy link

wuyushuooo commented Oct 7, 2017

我看您在后端接收到请求的时候派发给前端一个token,但是后端并没有进行任何存储,而在下次请求的时候jwt.verify直接读取出来,这是什么原理,从哪里读取出来的?我之前知道可以存储在数据库,session,或者redis中,而您的这种做法相比较有什么优劣势。假如是多用户的网站,给不同的用户下发token,也能这样来不存储token进行处理吗?

@flyfox11
Copy link
Owner

flyfox11 commented Oct 8, 2017

token是交给前端存储了,后端只做生成和验证token,这种方法是比较轻量级,不需要存储太多的东西在后端。给不同用户发不同token,客户端请求时,再传过来各自的token,后端用jwt验证通过了就ok,不通过就不能访问接口。是可以的。

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