【发布时间】:2014-11-20 15:30:10
【问题描述】:
我想使用 Django Rest Framework 身份验证,但我想为一位用户提供多个令牌。为此,我需要实现自己的 Token 模型,我在 Token 身份验证类中找到了这个:
class TokenAuthentication(BaseAuthentication):
"""
Simple token based authentication.
...
"""
model = Token
"""
A custom token model may be used, but must have the following properties.
* key -- The string identifying the token
* user -- The user to which the token belongs
"""
但我不知道如何指定此模型。我应该继承TokenAuthentication吗?
【问题讨论】:
标签: python django rest django-rest-framework