Django Rest框架中的多令牌认证 [英] Multiple Token Authentication in Django Rest Framework

查看:49
本文介绍了Django Rest框架中的多令牌认证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于django应用程序上只有一个令牌身份验证,因此用户如何登录多个设备.作为经过身份验证的用户,我在Google Chrome上登录时可以正常工作,但是当我在mozilla时访问并在Chrome中注销时,注销时已删除已创建的令牌,因此当我在mozilla上登录时,该令牌已经消失了,我们无法登录mozilla并在控制台上抛出禁止访问"响应.

How can a user login in multiple devices because what we have is just a single Token Authentication on our django app. As an authenticated user when I login on Google Chrome it works fine but when I visit at the mozilla time and I logged out at the chrome the token that has been created has been deleted upon logout so when I login at mozilla, the token is already gone and we can not log-in on mozilla and throws a Forbidden response on the console.

推荐答案

您的问题有点令人费解,但我认为您遇到的是这里提到的问题: https://github.com/tomchristie/django-rest-framework/issues/601

You're question is a little convoluted, but I think you are getting at the problem referenced here: https://github.com/tomchristie/django-rest-framework/issues/601

官方令牌认证不支持(不幸的是无意支持)多个令牌,但是您可以使用django-rest-knox,可在此处使用:

The official token authentication does not support (and unfortunately has no intention of supporting) multiple tokens, but you may be able to use django-rest-knox, available here: https://github.com/James1345/django-rest-knox

我以前推荐django-rest-multitoken,但是django-rest-knox似乎维护得更积极.

I previously recommended django-rest-multitoken, but django-rest-knox seems to be more actively maintained.

这篇关于Django Rest框架中的多令牌认证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆