Django OAuth Toolkit

I am trying to use oauth2 authentication with the django oauth toolkit. I got the following exception: Failed to import 'oauth2_provider.ext.rest_framework.OAuth2Authentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'

My settings.py file looks like this:

INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'adaccounts',
'corsheaders',
'clients',
'Gen42Backend',
'djcelery',
'oauth2_provider'

 )

REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': (
    'oauth2_provider.ext.rest_framework.OAuth2Authentication',
 )
 }

      

+3


source to share


1 answer


If anyone has the same problem.

Replace:

oauth2_provider.ext.rest_framework.OAuth2Authentication  

      



FROM

oauth2_provider.contrib.rest_framework.OAuth2Authentication

      

+1


source







All Articles