Skip to content

Create User Token

Glauber Costa Vila-Verde edited this page Jul 21, 2016 · 2 revisions

python manage.py shell

from rest_framework.authtoken.models import Token

from django.contrib.auth.models import User

u = User.objects.get(username='<username>')

token = Token.objects.create(user=u)

print(token.key)

Clone this wiki locally