django-rest-swagger icon indicating copy to clipboard operation
django-rest-swagger copied to clipboard

Django JWT authentication does not load all the protected urls

Open ihd2911 opened this issue 4 years ago • 2 comments

Following is my code in settings.py

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',
],

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.

ihd2911 avatar Jul 12 '19 09:07 ihd2911

To clarify this issue is in version 2.2.0 and works in swagger 2.1.2

ihd2911 avatar Jul 15 '19 11:07 ihd2911

This is a duplicated issue of #759

ghost avatar Jul 30 '19 21:07 ghost