Answer the question
In order to leave comments, you need to log in
Why is node.js updated on different request types?
All the good time of the day. There is a back code for user authorization. "Primary" authorization and with "/auth/me" path. In the primary there is a standard process. Here is the end of the code that writes data to the session
//result - результат сравнения хэшей.
if (result === true) {
resultCode = 0;
req.session.userId = results[key].id;
req.session.username = results[key].username;
//вместо "userId" и "email" должны быть куки
app.get('/auth/me', (req, res, next) => {
res.json({resultCode, userId, email})
})
Answer the question
In order to leave comments, you need to log in
So, the answer to the question arrived in the form of a property withCredentials: true
that I did not pass in the post (primary) request. Because of this, the cookie was cleaned, and my ass blazed like Vesuvius. Everyone for the future, if you want not to lose your cookie on the go, send it along with the request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question