问题描述
settings.py
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',],
views.py
from drf_yasg.views import get_schema_view
from drf_yasg import openapi
schema_view = get_schema_view(
openapi.Info(
title="接口文档",default_version='v1',description="使用youtube-dl 下载视频",contact=openapi.Contact(email="wh970305@163.com"),),public=True,)
然后未提供 API 返回身份验证凭据。 因为token不对
curl -X GET "http://localhost:8000/api/auth/info" -H "accept: application/json" -H "authorization: Basic YWRtaW46MTIzNDU2" -H "X-CSrftoken: TQ31NEGiMUJVUvqJKVKyua1hWgmHP614t0skwPqxQT0JvUR8PMqzXgIqAKzcgEhW"
解决方法
试试这个:Authorization: Bearer JWT_ACCESS_TOKEN