Inject csrf token into react app

This commit is contained in:
Logan Tegman
2016-05-09 10:13:02 -07:00
parent 921d5b1f55
commit c015cb5ec5
4 changed files with 10 additions and 4 deletions

View File

@@ -3,6 +3,9 @@ export default function globalLocals() {
// Make user object available in templates.
res.locals.user = req.user;
res.locals._csrf = req.csrfToken ? req.csrfToken() : null;
if (req.csrfToken) {
res.expose({ token: res.locals._csrf }, 'csrf');
}
next();
};
}