Hello,

I am trying to use oauth2 provider as described 
in 
http://django-oauth-toolkit.readthedocs.org/en/latest/rest-framework/getting_started.html#step-1-minimal-setup

'TokenAuthentication' object has no attribute 'has_permission.

Curl - curl -H "Authorization: Bearer $access_token" -H "Content-Type: 
application/json" -d '{"address": "afdsgsgsd", "another_address": 
"afedtgertretre"}'  -X POST http://localhost:8000/test

Here is my settings.py:


MIDDLEWARE_CLASSES = (
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'oauth2_provider.middleware.OAuth2TokenMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.security.SecurityMiddleware',
)


REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'oauth2_provider.ext.rest_framework.OAuth2Authentication',
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',

    )
}


and my urls.py


url(r'^test', Test.as_view() , name='Test'),


Error I am getting:


Request Method:POSTRequest URL:http://localhost:8000/testDjango 
Version:1.8.6Exception Type:AttributeErrorException Value:

'TokenAuthentication' object has no attribute 'has_permission'

Exception 
Location:/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/rest_framework/views.py
 
in check_permissions, line 318Python Executable:
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4Python 
Version:3.4.3Python Path:

['/Users/ctippur/PycharmProjects/dropboat',
 '/Users/ctippur/PycharmProjects/dropboat',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python34.zip',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/plat-darwin',
 '/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/lib-dynload',
 
'/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages']



-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/d9e99fa9-c895-4fec-94f3-f67789d81e88%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to