I have an existing, working Django application that implements numerous Django-REST-framework APIs. I've just added user authentication with Django-rest-framework-JWT and now I'm trying to learn it up. I have verified that it does issue me a token if I do the following curl:
curl -X POST -d "username=myuser&password=mypassword" http://localhost:3050/api-token-auth/
But I have a series of questions that I don't see being addressed in the documents. Please answer the following questions:
- How do I invalidate the token using curl? I need to do so when the user logs out.
- Where are these tokens stored in the DB? After implementing
django-rest-framework-jwt
, I don't see any new tables in my Django Admin interface - I would like to allow my users to login with their usernames or their emails. So I would like to wrap the
api-token-auth
endpoint in a custom endpoint that checks if the given string is an email or username. If email, I will lookup the username. Then call the api-token-auth. How should that endpoint look? I don't know how to wrap thisapi-token-auth method
.