I authenticated my user in Django using the PSA and registered the user in the user model, and even the token model has a registered user and a registered token.
But when I send this request:
curl -X POST -H "Authorization:Token 87e939184457ccc064485444a90e3ebf417xxxxx" http://192.168.x.x:8000/user-profiles/>error.html
I get
{"detail": "You do not have permission to perform this action." }
And if I send this:
curl -X POST --user "VedantDasSwain:87e939184457ccc064485444a90e3ebf417xxxxx" http://192.168.x.x:8000/user-profiles/>error.html
I get
{"detail": "Invalid username / password"}
These are the relevant snippets from my settings file:
'DEFAULT_PERMISSION_CLASSES': ('rest_framework.permissions.IsAuthenticated',
'rest_framework.permissions.IsAdminUser',),
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
And this is part of the PSA settings:
AUTHENTICATION_BACKENDS = (
'social.backends.facebook.FacebookOAuth2',
'django.contrib.auth.backends.ModelBackend',
)
Has anyone come across anything like this before? What is the solution to this?
source
share