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

后端 未结 2 2083
夕颜
夕颜 2021-02-12 18:43

It\'s the first time I work with django rest and Django Oauth toolkit I\'m following this tutorial oauth2-with-django-rest-framework But when I run python manage.py migrate I g

相关标签:
2条回答
  • 2021-02-12 18:58

    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

    0 讨论(0)
  • 2021-02-12 19:06

    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.

    0 讨论(0)
提交回复
热议问题