DRF的json web token方式完成用户认证

一、安装

pip install djangorestframework-jwt

二、使用

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
    )
}

三、url

# jwt的token认证接口
path('jwt-auth/', obtain_jwt_token )

四、postman

原文地址:https://www.cnblogs.com/mxsf/p/10665076.html