0

My django rest api endpoints were working with the JWT authentication. Later I changed that to Oauth 2 toolkit. All are working fine from postman rest app. But the api doc test endpoints are not working. It shows the following screen.

API endpoint testing screen

This page still shows even if I am logged in as administrator. Is there any change I need to do in the settings file?

Current settings in settings.py is

OAUTH2_PROVIDER = {
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
}

REST_FRAMEWORK = {
'DATETIME_FORMAT': "%m/%d/%Y %H:%M:%S",
'DATE_FORMAT' : "%m/%d/%Y",
'DEFAULT_PERMISSION_CLASSES': (
    'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
    'oauth2_provider.ext.rest_framework.OAuth2Authentication',
),
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 50,
'EXCEPTION_HANDLER': 'app_utils.views.exception_handler'
}
Arun SS
  • 1,791
  • 8
  • 29
  • 48
  • Did you change header? If I am not mistaken for OAUTH2 you need to send Authorization header with Bearer value? – Jan Giacomelli Apr 15 '17 at 13:30
  • Its regarding the api listing and testing in browser. – Arun SS Apr 16 '17 at 15:33
  • I know but If you have set IsAuthanticated as permisson class you need to auth user with token. If you just want to access endpoint without any header set it won't let you through while you are not authenticated user. – Jan Giacomelli Apr 16 '17 at 18:25

0 Answers0