简体   繁体   English

django rest API开发使用Swagger UI,有“详细信息”:“未提供身份验证凭据。”

[英]django rest API development Using Swagger UI, got“detail”: “Authentication credentials were not provided.”

currently involving in a django- based project, working on rest API development. 目前参与一个基于django的项目,从事剩余API的开发。 Using Swagger for tracking docs. 使用Swagger跟踪文档。 Everything went well until today. 一切顺利,直到今天。 Today I tried to add some testcase for endpoints. 今天,我尝试为端点添加一些测试用例。 In order to make test work, for some reason, I need to set SOUTH_TESTS_MIGRATE = False and remove allauth.socialaccount from INSTALLED_APPS in settings. 为了使测试有效,出于某种原因,我需要设置SOUTH_TESTS_MIGRATE = False并从设置中的INSTALLED_APPS中删除allauth.socialaccount。 But after that the response code return 403 when I tried to use Swagger for tracking every endpoints in API. 但是之后,当我尝试使用Swagger跟踪API中的每个端点时,响应代码返回403。

Here is the response body {"detail": "Authentication credentials were not provided."}. 这是响应正文{“ detail”:“未提供身份验证凭据。”}。

What I have done to try to fix this issue is set back settings. 我为解决此问题所做的工作是撤回设置。 But still return the same response code and response body. 但是仍然返回相同的响应代码和响应主体。

Anyone have any ideas about this issue? 有人对这个问题有任何想法吗? Super wired since it should work when setting back all settings. 超级有线,因为它应该在重新设置所有设置时起作用。 Thanks in advanced! 提前致谢!

Considering the response and the information you have provided, I assume your api views require authentication. 考虑到响应和您提供的信息,我假设您的api视图需要身份验证。 You can provide an api key to swagger in your settings.py as documented here under the 'Configuration' header 您可以提供一个api密钥,如在“配置”标题下此处所述,在您的settings.py大摇大摆

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Django Rest Framework {“detail”:“未提供身份验证凭据。”} - Django Rest Framework {“detail”:“Authentication credentials were not provided.”} Django:“详细信息”:“未提供身份验证凭据。” - Django : “detail”: “Authentication credentials were not provided.” Django-rest-framework {“详细信息”:“未提供身份验证凭据。” } 使用 django-rest-knox - Django-rest-framework {“detail”: “Authentication credentials were not provided.” } using django-rest-knox 自定义Django休息框架身份验证响应{“详细信息”:“未提供身份验证凭据。”} - Customize Django rest framework authentication response {“detail”: “Authentication credentials were not provided.”} "detail": "未提供身份验证凭据。" Django-rest-frameweork 和 React - "detail": "Authentication credentials were not provided." Django-rest-frameweork and React DRF:“详细信息”:“未提供身份验证凭据。” - DRF: “detail”: “Authentication credentials were not provided.” 禁止:/api/v1.0/user/create-user/ & {“detail”:“未提供身份验证凭据。” } DJANGO - Forbidden: /api/v1.0/user/create-user/ & { "detail": "Authentication credentials were not provided." } DJANGO Django Rest Framework JWT“未提供身份验证凭据。”} - Django Rest Framework JWT “Authentication credentials were not provided.”} "detail": "未提供身份验证凭据。" 一般视图 - "detail": "Authentication credentials were not provided." for general views Python 请求与 Django Rest 框架 - “详细信息”:“未提供身份验证凭据” - Python Requests with Django Rest Framework - 'detail': 'Authentication credentials were not provided'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM