我在django rest框架中创建了一个项目,安装了django auth provider,创建了一个应用程序,生成了客户机id和客户机机密,当我使用curl请求测试应用程序时
curl-xpost-d“grant_type=password&username=&;password=”-u“http://localhost:8000/o/token/
我通过给出我的用户名、密码、客户端用户名和客户端请求进行了测试,结果显示错误如下
{"error": "invalid_client"}
在设置.py在
OAUTH2_PROVIDER = {
# this is the list of available scopes
'SCOPES': {'read': 'Read scope',
'write': 'Write scope',
'groups': 'Access to your groups'}
}
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.IsAuthenticated',
),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
'oauth2_provider.ext.rest_framework.OAuth2Authentication',
)
}
你在你的网址中使用了'o'i,所以你的urs.py必须包含
你的网址好像不知道网址.py在
例如
^{pr2}$会使
正常渲染。在
相关问题 更多 >
编程相关推荐