-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
The cookies created in server side(HTTP server) isnt visible to FrontEnd script
I have created an Array of Cookies using Set-Cookie inside createServer method
res.setHeader('Set-Cookie', [
'sessionId=abc123; SameSite=None;Secure;',
'username=ratul; SameSite=None;Secure;',
'name=Ratul; SameSite=None;Secure;'
]);
According to Cross Origin resource sharing if my domain or PORT is different then i have to used
`"Access-Control-Allow-Origin":`` 'http://X.X.X.X:3000
[',]
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
'Access-Control-Allow-Headers': 'Content-Type,user-agent,X-Client-Header',
'Access-Control-Allow-Credentials': 'true'
YES I Have used it and Since my frontend sending CORS request hence i have also used
'credentials':'include'
STILL
whensoever i do on (FrontEnd Script)
document.cookie -----> this gives empty string
OR
res.headers.get('Set-Cookie') ---> gives null
I have attached my repo below
HTML_CSS_JS_PRACTICE/HTML_CSS_JS_30/PS3
Metadata
Metadata
Assignees
Labels
No labels