Could not import 'oauth2_provider.ext.rest_framework.OAuth2Authentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'

It looks like oath2_provider.ext has been moved to oauth_provider.contrib. You could try installing an older version of django-oauth-toolkit, or try changing the value in DEFAULT_AUTHENTICATION_CLASSES from:

'oauth2_provider.ext.rest_framework.OAuth2Authentication',

to:

'oauth2_provider.contrib.rest_framework.OAuth2Authentication',

Note that the tutorial is a couple of years old, you might find other problems like this.


I was facing same issue. In my setting file DEFAULT_AUTHENTICATION_CLASSES was already 'oauth2_provider.contrib.rest_framework.OAuth2Authentication',

I just installed older version as @Alasdair ask. My issue resolved. thanks