设置.py
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
视图.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 返回身份验证凭据。因为令牌是错误的
curl -X GET "http://localhost:8000/api/auth/info" -H "accept: application/json" -H "authorization: Basic YWRtaW46MTIzNDU2" -H "X-CSRFToken: TQ31NEGiMUJVUvqJKVKyua1hWgmHP614t0skwPqxQT0JvUR8PMqzXgIqAKzcgEhW"