I am trying to implement JSON wen token in Django. I have been following tutorial from this source I have installed and configured all the necessary requirements.
To obtain user's token, here is the curl example:
$ curl --request POST \
--url http://localhost:8000/jwt-auth/ \
--header 'content-type: application/json' \
--data '{"username": "myusername", "password": "mypass"}'
{"token": "YOUR_JWT_TOKEN"}
Here is my code for making call
import requests
item = { "username": "admin", "password": "admin"}
resp1 = requests.post("http://localhost:8000/auth-jwt/",
data=json.dumps(item),
headers={
"Content-Type":"application/json",
"Accept": "application/json"
}
)
print (resp1.status_code)
#print (resp1.content)
content = json.loads(resp1.content)
print(content)
#print(content['status'])
My issues:
When I run the above code, it returns error
non field error: unable to login with provided credentials
What does this mean. which table do I have to create to use their credentials. Currently I have users nancy on auth_user table.
Consequently, a similar issue has been resolved here but I cannot get it to work.
What does the error mean, and what is the next step in solving the problem?