#get cookie from a site

1 messages · Page 1 of 1 (latest)

fleet arrow
#

Why would a one off request have cookies?

#

Cookies are a browser/session thing.

#

Are you trying to access the cookies that your browser sees?

rotund eagle
#

well the cookie is here

#

but there is no set-cookie

#

thats why i'm confused

fleet arrow
#

Because it already exists???

rotund eagle
#

well how can i get it?

#

on node js

fleet arrow
#

Are you trying to access cookies in your browser from node.js?

rotund eagle
#

i guess

#

u can have a look at my script

#

i think that's what i mean to do

fleet arrow
#

Ok the cookies in your browser exist in your browser. It then provides them with each request and the server then provides cookies based on that.

When you make a request from node.js your code is not a part of the browser so you have to provide whatever cookies you want to provide, and then the server will provide the correct cookies based on that.

Essentially your node.js program is its own browser and has no interaction with any other browser. So you can't see cookies from one place in the other place.

rotund eagle
#

When you make a request from node.js your code is not a part of the browser so you have to provide whatever cookies you want to provide, and then the server will provide the correct cookies based on that. so if i provide some cookies and the server provides the correct ones, can i then get the correct cookie?

fleet arrow
#

Yes. You may also be in violation of the services ToS.

rotund eagle
#

i wont its just a test

#

but still i do just request.headers... and it's undefined

fleet arrow
#

A test is still a violation lol

#

They may be detecting you're not a browser

rotund eagle
#

ugh

#

thats confusing

#

so what should i do?

fleet arrow
#

Often times cookies have a lot of security around them to prevent session hijacking. Which it sounds like is what you're essentially trying to do.

tribal patio
#

😂 rip. Gonna have to make a browser

rotund eagle
#

is there anything i should do to get the cookie? if its possible for you to help

fleet arrow
#

There's no way for me to know what you're actually trying to accomplish so I can't in good conscience help with this. Session hijacking is a very real possibility whether you deny it or not.

I've explained what's likely going on and why what you're doing hasn't worked. That's about as far as we can allow this to go here. Sorry.