I'm writing a single page application with MEAN stack
, and using express-session
with redis
for session management.
I want to use scrf token in my client's cookies.
the problem is when I add csurf
middleware, it set a session with name csrfSecret
in redis, but how can I send it in cookie to client?
middlewares :
app.use(csrf({}));
app.use(function(req, res, next) {
res.cookie('csrf-token', req.csrfToken());
return next();
});
and csrf-token
is sending to client but it don't do anything.and I receive 403 error from module.
thank you for any answer or idea.