简体   繁体   English

Django-安全地存储用户API会话令牌

[英]Django - Storing a users API session token securely

I have an application which issues a simple request with basic auth which returns a session token. 我有一个应用程序,该应用程序使用基本身份验证发出简单的请求,该请求返回会话令牌。 I then want to use that token for subsequent calls to that same application interface. 然后,我想将该令牌用于对同一应用程序接口的后续调用。

My question is, is it OK to store this token in the session/cookie of the logged in user, or should I approach this a different way? 我的问题是,可以将此令牌存储在已登录用户的会话/ Cookie中,还是应该以其他方式处理? I want to ensure 100% user security at all times. 我想一直确保100%的用户安全。

A session cookie is not a bad solution. 会话cookie并不是一个不错的解决方案。 You could also mark the cookie as "secure" to make sure that it only can be sent over https. 您还可以将cookie标记为“安全”,以确保只能通过https发送。 It is far better than using ie localstorage. 它比使用本地存储要好得多。

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

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