Inject csrf token into react app
This commit is contained in:
@@ -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();
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user