“ detail”:“未提供身份验证凭据。Django

时间:2020-01-22 19:03:16

标签: python django django-rest-framework

我正在使用会话身份验证,尝试从邮递员进行访问时收到以下错误,它较早起作用,我更改了一些URL并开始运行。非常感谢您的帮助。

   "detail": "Authentication credentials were not provided.

settings.py

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework.authentication.SessionAuthentication',
        'send.auth.ClientAuthentication'
    ],
}

urls.py

router = routers.DefaultRouter()
router.register('api/v1/app', views.AppOnboardingView)
router.register('api/v1/client', views.UserAccessHandleView)
router.register('api/v1/upload', views.FileView)

urlpatterns = [
    path('', include(router.urls)),
    path('api/v1/tokenget/', views.GetApptokenView.as_view()),
    path('api/v1/refresh/', views.RefreshAccessView.as_view())

]

views.py

class AppOnboardingView(viewsets.ModelViewSet):
    queryset = AppOnboarding.objects.all()
    serializer_class = AppOnboardingSerializer
    lookup_field = 'id'
    authentication_classes = [SessionAuthentication, BasicAuthentication]
    permission_classes = [IsAuthenticated, IsMaintainer]

0 个答案:

没有答案