How does the Django-REST-Framework store the user's authentication token?

Viewed 321

Reading the Django REST framework documentation, I understand that token authentication can be created and for a user:

from rest_framework.authtoken.models import Token

token = Token.objects.create(user=...)
print(token.key)

And then checked on a view-by-view basis.

When accessing the API from the command line, the documentation shows that the Token is supplied in the header like so:

curl -X GET http://127.0.0.1:8000/api/example/ -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'

My question is, when going through the browsable API, how does Django already know my user token without having to supply it like in the curl command?

0 Answers
Related