I'm trying to implement session
based authentication the first time using React
and Django Rest Framework
, but there's some weird thing I don't understand.
I have a pretty standard Login
view, so I send POST
request from React
with username
and password
, I got response with status 200 and I can see cookies in the response with Chrome developer tools
.
But these cookies aren't being saved.
If I do the same POST
request with Rest plugin for Chrome - it saves them.
Am missing something here since it's my first time?
Or should I save it manually somehow?
Here's my request with
axios
. Do I need to add something here?
const sendLogin = () => {
if (login && password) {
axios.post(SERVER_ADDRESS + 'login/', {username: login, password: password})
.then(response => {
if (response.status !== 200) {
handleClick();
}
else {
history.push('/');
}
})
}
}