When i login using my api in the swagger and fill in the information in the Authorize button pop up, my api list which is protected still does not appear.
I tried adding it as 'Bearer token', but it do not work.
Following is my code:
SWAGGER_SETTINGS = {
'LOGIN_URL': 'api:login',
'LOGOUT_URL': 'api:logout',
'USE_SESSION_AUTH': False,
'DOC_EXPANSION': 'list',
'APIS_SORTER': 'alpha',
'SECURITY_DEFINITIONS': {
'api_key': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorization',
"description": "JWT authorization"
}
},
}
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
],
# Permission settings
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAuthenticated',
],
I am using django-rest-swagger==2.2.0. It works in swagger 2.1.2
in your root urls.py s
you should check if it has
permission_classes
set to AllowAny! or you just forget to add them!p.s. It's too late but maybe helps others!