Skip to content

Instantly share code, notes, and snippets.

@Lazhari
Created July 26, 2015 04:36
Show Gist options
  • Save Lazhari/3de7e7cb27807645ac29 to your computer and use it in GitHub Desktop.
Save Lazhari/3de7e7cb27807645ac29 to your computer and use it in GitHub Desktop.
Enable Express csrf protection
//Enable Express csrf protection
app.use(express.csrf());
app.use(function(req, res, next) {
res.locals.csrftoken = req.csrfToken();
next();
});
<input type="hidden" name="_csrf" value="{{ csrftoken } }">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment