mirror of
https://github.com/sasjs/server.git
synced 2025-12-11 03:34:35 +00:00
fix: added more cookies to req
This commit is contained in:
@@ -6,12 +6,18 @@ export const getPreProgramVariables = (req: any): PreProgramVars => {
|
||||
const { user, accessToken } = req
|
||||
const csrfToken = req.headers['x-xsrf-token']
|
||||
const sessionId = req.cookies['connect.sid']
|
||||
const { _csrf } = req.cookies
|
||||
|
||||
const httpHeaders: string[] = []
|
||||
|
||||
if (accessToken) httpHeaders.push(`Authorization: Bearer ${accessToken}`)
|
||||
if (csrfToken) httpHeaders.push(`x-xsrf-token: ${csrfToken}`)
|
||||
if (sessionId) httpHeaders.push(`cookie: connect.sid=${sessionId}`)
|
||||
|
||||
const cookies: string[] = []
|
||||
if (sessionId) cookies.push(`connect.sid=${sessionId}`)
|
||||
if (_csrf) cookies.push(`_csrf=${_csrf}`)
|
||||
|
||||
if (cookies.length) httpHeaders.push(`cookie: ${cookies.join('; ')}`)
|
||||
|
||||
return {
|
||||
username: user.username,
|
||||
|
||||
Reference in New Issue
Block a user