rest框架具有默认的基于web的API身份验证。
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
但是,一旦添加JWT身份验证并将权限设置为IsAuthenticated,您就不能再使用默认或内置的API身份验证。
HTTP 401 Unauthorized Allow: GET, POST, HEAD, OPTIONS Content-Type: application/json Vary: Accept WWW-Authenticate: Bearer realm="api" "detail": "Authentication credentials were not provided."