How do I create a login API using Django Rest Framework?

Take a look at the api view from django-rest-framework-jwt. It’s an implementation for creating auth tokens rather than cookie sessions, but your implementation will be similar. See and You can probably use the unchanged, and just adjust your views to return the right parameters and possibly set the session cookie (can’t recall if that’s already performed in authentication).

Leave a Comment