title: Django DRF with oAuth2 using DOT (django-oauth-toolkit)
body: <p>I am trying to make DRF work with oAuth2 (django-oauth-toolkit).</p>
  
  <p>I was focusing on <a href="http://httplambda.com/a-rest-api-with-django-and-oauthw-authentication/" rel="noreferrer">http://httplambda.com/a-rest-api-with-django-and-oauthw-authentication/</a></p>
  
  <p>First I followed that instruction, but later, after getting authentication errors, I setup this demo: <a href="https://github.com/felix-d/Django-Oauth-Toolkit-Python-Social-Auth-Integration" rel="noreferrer">https://github.com/felix-d/Django-Oauth-Toolkit-Python-Social-Auth-Integration</a></p>
  
  <p>Result was the same: I couldn't generate access token using this curl:</p>
  
  <pre><code>curl -X POST -d "grant_type=password&amp;username=&lt;user_name&gt;&amp;password=&lt;password&gt;" -u "&lt;client_id&gt;:&lt;client_secret&gt;" http://127.0.0.1:8000/o/token/
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>{"error": "unsupported_grant_type"}
  </code></pre>
  
  <p>The oAuth2 application was set with grant_type password. I changed grant_type to "client credentials" and tried this curl:</p>
  
  <pre><code>curl -X POST -d "grant_type=client_credentials" -u "&lt;client_id&gt;:&lt;client_secret&gt;" http://127.0.0.1:8000/o/token/
  </code></pre>
  
  <p>This worked and I got generated auth token.</p>
  
  <p>After that I tried to get a list of all beers:</p>
  
  <pre><code>curl -H "Authorization: Bearer &lt;auth_token&gt;" http://127.0.0.1:8000/beers/
  </code></pre>
  
  <p>And I got this response: </p>
  
  <pre><code>{"detail":"You do not have permission to perform this action."}
  </code></pre>
  
  <p>This is the content of <strong>views.py</strong> that should show the beers:</p>
  
  <pre><code>from beers.models import Beer
  from beers.serializer import BeerSerializer
  from rest_framework import generics, permissions
  
  class BeerList(generics.ListCreateAPIView):
      serializer_class = BeerSerializer
      permission_classes = (permissions.IsAuthenticated,)
  
      def get_queryset(self):
          user = self.request.user
          return Beer.objects.filter(owner=user)
  
      def perform_create(self, serializer):
          serializer.save(owner=self.request.user)
  </code></pre>
  
  <p>I am not sure what can be the problem here. First with "unsuported grant type" and later with other curl call. This also happen to me when I did basic tutorial from django-oauth-toolkit. I am using Django 1.8.2 and python3.4</p>
  
  <p>Thanks for all help!</p>
  
  <p>My settings.py looks like this</p>
  
  <pre><code>import os
  BASE_DIR = os.path.dirname(os.path.dirname(__file__))
  
  SECRET_KEY = 'hd#x!ysy@y+^*%i+klb)o0by!bh&amp;7nu3uhg+5r0m=$3x$a!j@9'
  
  DEBUG = True
  
  TEMPLATE_DEBUG = True
  
  ALLOWED_HOSTS = []
  
  TEMPLATE_CONTEXT_PROCESSORS = (
      'django.contrib.auth.context_processors.auth',
  )
  
  INSTALLED_APPS = (
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
  
      'oauth2_provider',
      'rest_framework',
      'beers',
  )
  
  MIDDLEWARE_CLASSES = (
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  )
  
  AUTHENTICATION_BACKENDS = (
      'django.contrib.auth.backends.ModelBackend',
  )
  ROOT_URLCONF = 'beerstash.urls'
  
  WSGI_APPLICATION = 'beerstash.wsgi.application'
  
  DATABASES = {
      'default': {
          'ENGINE': 'django.db.backends.sqlite3',
          'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
      }
  }
  
  LANGUAGE_CODE = 'en-us'
  
  TIME_ZONE = 'UTC'
  
  USE_I18N = True
  
  USE_L10N = True
  
  USE_TZ = True
  
  STATIC_URL = '/static/'
  
  REST_FRAMEWORK = {
      'DEFAULT_AUTHENTICATION_CLASSES': (
          'oauth2_provider.ext.rest_framework.OAuth2Authentication',
      )
  }
  
  OAUTH2_PROVIDER = {
      # this is the list of available scopes
      'SCOPES': {'read': 'Read scope', 'write': 'Write scope'}
  }
  </code></pre>