Created
July 26, 2015 04:36
-
-
Save Lazhari/3de7e7cb27807645ac29 to your computer and use it in GitHub Desktop.
Enable Express csrf protection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Enable Express csrf protection | |
app.use(express.csrf()); | |
app.use(function(req, res, next) { | |
res.locals.csrftoken = req.csrfToken(); | |
next(); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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