With the django rest framework
I was using django-rest-framework-simplejwt
from here.
According to the guideline given, my settings.py
REST_FRAMERWORK
should look like:
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': (
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
),
'DEFAULT_AUTHENTICATION_CLASSES': [
'rest_framework_simplejwt.authentication.JWTAuthentication',
],
}
Now when I call the api /api/token/
with the help of CURL
like this:
curl -X POST -H "Content-Type: application/json" -d '{"username": "aami", "password": "ooma"}' http://127.0.0.1:8000/api/token/
I get the following error:
curl -X POST -H "Content-Type: application/json" -d '{"username": "aami", "password": "ooma"}' http://127.0.0.1:8000/api/token/
And the server side the log is:
Bad Request: /api/token/ [12/Apr/2019 15:01:02] "POST /api/token/ HTTP/1.1" 400 75
I followed what the guidelines mentioned but I still can't figure out what's wrong.
no active account with the given credentials
, it seems you are not passing the correctusername
andpassword
, or theusername
does not exists. – afonso