Trying to do everything exactly as in the Framework documentation.

from rest_framework.authtoken import views urlpatterns = [ url(r'^api-token-auth/', views.obtain_auth_token), ] 

Inside models.py

 @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_auth_token(sender, instance=None, created=False, **kwargs): if created: Token.objects.create(user=instance) 

But I always get

  { "username": [ "This field is required." ], "password": [ "This field is required." ] } 

Postman window

    3 answers 3

    The user with the given username must exist.

      Judging by the server’s response, the view for some reason does not see your transmitted fields (if the error field returns This field is required, then the corresponding fields in the received data are empty). Look at the request that comes to the server, which is in the body of the request.

        It is necessary to transfer information to the body of the request. For example: {"username": "Werton", "password": "xpto"}