from rest_framework.exceptions import AuthenticationFailed
import jwt
from rest_framework_jwt.authentication import BaseJSONWebTokenAuthentication
from rest_framework_jwt.authentication import jwt_decode_handler
3、普通自定义认证类
from rest_framework.authentication import BaseAuthentication
def authenticate(self, request):
auth = 从request中得到
user = 从auth中得到
ifnot user:
return None
return user, auth