简体   繁体   English

使用 REST Framework Django 进行身份验证

[英]Authentication with REST Framework Django

I'm new to Django and curious how the authentication of Rest Framework works.我是 Django 的新手,很好奇 Rest Framework 的身份验证是如何工作的。

So as I understand, the flow of authentication is: Frontend sends request with username and password > Backend (Django) sends back token > From then on frontend send this token in header to authenticate.据我了解,身份验证的流程是:前端发送带有用户名和密码的请求 > 后端(Django)发送回令牌 > 从那时起,前端在标头中发送此令牌以进行身份​​验证。

But because anyone can see the header I send, so how is this safe?但是因为任何人都可以看到我发送的标题,所以这如何安全?

For this to be secure you should only ever authenticate over an https connection.为了安全起见,您应该只通过 https 连接进行身份验证。 When using an https connection the header/token/cookie/whatever will be encrypted.使用 https 连接时,标头/令牌/cookie/任何内容都将被加密。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM