I
I
Idobrodushniy2017-07-20 18:44:48
React
Idobrodushniy, 2017-07-20 18:44:48

How to know current user Django-rest-framework + rest-auth + ReactJS?

There is an application on django-rest + Reactjs. For login I use rest-auth. I send using Jquery AJAX to /auth/login and the user logs in - a token is returned in response. Question: How can I find out the id of the current user after login?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mykola, 2017-07-20
@IKMOL

rewrite the serializers, add the id field next to the key(token) and that's it.

D
davidnum95, 2017-07-24
@davidnum95

you can use JWT

O
Oleg Gamega, 2017-07-20
@gadfi

  1. why do you need jquery? what fetch or axios did not please at worst
  2. if your api requires the user to know their id, then store it as a token

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question