You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 26, 2020. It is now read-only.
I have a Rest API working (all good here) with django-rest-framework and django-rest-framework-jwt.
My problem is that I am trying to access the DRF Built-in API documentation for authenticated users only and I am unable to make it work. It throws me 401 error {u'detail': ErrorDetail(string=u'Authentication credentials were not provided.', code=u'not_authenticated')}.
Below I provide you relevant sections of my code and settings.
Urls:
# Rest Documentation
API_TITLE = 'Rest API'
API_DESCRIPTION = 'Rest API Description'
API_PUBLIC = False
AUTHENTICATION_CLASSES = [JSONWebTokenAuthentication] # is this correct?
PERMISSION_CLASSES = [IsAuthenticated] # of course, when I change this to AllowAny it works, but I need it restricted.
PATTERNS = rest_api_urlspatterns
rest_api_docs_urlspatterns = [
# Generate schema with valid `request` instance:
url(r'^docs/', include_docs_urls(
title=API_TITLE,
description=API_DESCRIPTION,
authentication_classes=AUTHENTICATION_CLASSES,
permission_classes=PERMISSION_CLASSES,
public = API_PUBLIC,
patterns = rest_api_urlspatterns
))
]
Hello,
I have a Rest API working (all good here) with django-rest-framework and django-rest-framework-jwt.
My problem is that I am trying to access the DRF Built-in API documentation for authenticated users only and I am unable to make it work. It throws me 401 error
{u'detail': ErrorDetail(string=u'Authentication credentials were not provided.', code=u'not_authenticated')}
.Below I provide you relevant sections of my code and settings.
Urls:
Settings:
Additionally, my views are restricted to IsAuthenticated:
Any idea what could be happening? Thank you very much!
The text was updated successfully, but these errors were encountered: