首页 > TAG信息列表 > AuthenticationFailed

自定义基于jwt的验证

# 3 自定义基于jwt的权限类 from rest_framework.authentication import BaseAuthentication # 基于它 from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication # 基于它 from rest_framework.exceptions import AuthenticationFailed # from rest_fram

2.3 认证组件的使用

# 写一个认证类 app_auth.py from rest_framework.authentication import BaseAuthentication from rest_framework.exceptions import AuthenticationFailed from app01.models import UserToken class MyAuthentication(BaseAuthentication): def authenticate(self, reque