Django Rest Oauth2中的客户端凭据

时间:2019-02-13 14:12:41

标签: django django-rest-framework

我正在将Authorization Grant Type用作Client-Crendential。但是当我使用`access_token

访问它时
http://localhost:8000/api/jobs/list/access_token=yTpq4qbjnp4gTI7Ur7HRiYGIjGteMn` 

它给出错误/消息为

  

{       “ detail”:“您无权执行此操作。” }

Settings.py

OAUTH2_PROVIDER = {
    # this is the list of available scopes
    'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}
}

REST_FRAMEWORK = {
    # Use Django's standard `django.contrib.auth` permissions,
    # or allow read-only access for unauthenticated users.
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'oauth2_provider.contrib.rest_framework.OAuth2Authentication',
        'rest_framework.authentication.SessionAuthentication', # To keep the Browsable API
    ),
    'DEFAULT_PERMISSION_CLASSES': (
        'rest_framework.permissions.IsAuthenticated',
    ),

}

我看不到数据。

0 个答案:

没有答案