简体   繁体   中英

how to retrieve the token generated while using django allauth and django-rest-auth with django rest framework

I am using django allauth and django-rest-auth from this tutorial to generate a token for django rest framework . The tutorial can be found on this page, at the bottom. ( https://www.softcover.io/read/92780ad5/django_book/token_authentication )

I am able to generate the token after accessing api/dj-rest-auth/register/ , which is the sign up page from the browsable API.

在此处输入图像描述

在此处输入图像描述

Now the issue is that i am on python3 manage.py shell and i am trying to retrieve any of the token generated for either user test001 or test002

does any one know how to do it? I am having a hardtime to achieve it

Thanks in advance

tokens_for_user1_and_user2 = APIToken.objects.filter(user__name__in=["test001","test002"]).all()

I guess... or something like that

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM