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

登录后获取用户信息代码不明白,请指教 #21

Open
didiplus opened this issue Nov 20, 2019 · 2 comments
Open

登录后获取用户信息代码不明白,请指教 #21

didiplus opened this issue Nov 20, 2019 · 2 comments

Comments

@didiplus
Copy link

获取用户信息函数有点看不明白

图片

request.user.id 根据判断用户是否有登录,但是我在看前端代码时候,发现登录后返回一个token值,并没有user id的参数发起get的请求

@shaxian
Copy link

shaxian commented Nov 21, 2019

我的理解是, request 携带的token 通过验证之后, 这个 request.user 就是 user表的一个实例对象。 可以取出他的所有属性

@dyzsoft
Copy link

dyzsoft commented Jul 5, 2020

获取用户信息函数有点看不明白

图片

request.user.id 根据判断用户是否有登录,但是我在看前端代码时候,发现登录后返回一个token值,并没有user id的参数发起get的请求

request.user.id 是通过验证后放到request中的变量,具体看 django request 相关。token认证也是一种认证。

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

3 participants