I am using the node.js and express to build a simple server, in which CSRF is being imlemented through express framework.
app.use(express.csrf());
app.use(function(req, res, next){
res.locals.token = req.session._csrf;
res.locals.year = new Date().getFullYear();
next();
});
The Connect CSRF middleware automatically generates the req.session._csrf token, and this function maps it to res.locals.token so it will be available to templates made from ejs. This works well with web application.
But when it comes to my mobile application made from android, for example to login, only send the username and password without the CSRF token will lead the server to reject the request.
as the previous code works only for web template, so my question is how to receive this token in the android enabled application
best rgds xi