1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-03 21:10:05 +00:00

fix: get csrf token from cookie if not present in header

This commit is contained in:
Saad Jutt
2022-05-16 15:30:08 +05:00
parent fadcc9bd29
commit f89389bbc6

View File

@@ -4,7 +4,7 @@ export const getPreProgramVariables = (req: any): PreProgramVars => {
const host = req.get('host') const host = req.get('host')
const protocol = req.protocol + '://' const protocol = req.protocol + '://'
const { user, accessToken } = req const { user, accessToken } = req
const csrfToken = req.headers['x-xsrf-token'] const csrfToken = req.headers['x-xsrf-token'] || req.cookies['XSRF-TOKEN']
const sessionId = req.cookies['connect.sid'] const sessionId = req.cookies['connect.sid']
const { _csrf } = req.cookies const { _csrf } = req.cookies