what should I use to parse cookies from the request headers?
@toastynerd Is there any reason I can't take JWT from header, or cookie header, or from the body of a request?
Erik Nilsen
@enilsen16
@Talamantez Thats pretty cool
Kevin Stephens
@kevinmstephens
Trying to lock down my map tile server by having the request go through node, node will verify the cookie then pipe the images right back to the browser, but google map library is making get requests with the provided url and I can't attach a jwt to the header
but the jwt is present in the cookie which is in the header
oh I found the cookie as a string in the header, what's the advance of cookie-parser?
that I don't have to parse the string to get the cookies probably?
thanks Anna Luisa!
Anna Luisa Patiño West
@aisapatino
it just attaches it to the request so you can do req.cookies[name]
Kevin Stephens
@kevinmstephens
@toastynerd Design questions for ya. Say I have http required in server.js and I need it in one of my route files, what's the difference between requiring it into myRoute.js and passing it from server.js to myRoute.js with app and jwtauth.auth?
server.js doesn't do anything to http so I'm guessing it's best to just require it right into myRoute.js but I don't get the difference conceptually
or anyone else that knows
Tyler Morgan
@toastynerd
@kevinmstephens why do you need http in a route? It’s usually just used to start a server.
but yes, you can just require it into a route and it should be fine
Kevin Stephens
@kevinmstephens
ok, I want to pipe data from a map tile server to the client browser
so I can enforce auth auth
so I'm doing http.request(options, function(response) etc etc
trying to figure out the pipe stuff
Tyler Morgan
@toastynerd
if you’re going to the browser and you need two way data, use socket.io
Kevin Stephens
@kevinmstephens
problem is that it's google map api library doing the get request
i might be able to figure out a socket connection work around but gonna try to get this get request working first
when you pan the map the google library knows which tiles it needs and makes get requests for each tile
Tyler Morgan
@toastynerd
It kind of sounds like you’re going about it the wrong way but it’s hard to tell without looking at the code.
Kevin Stephens
@kevinmstephens
the problem is it's time to get rid of geoserver and find a node map tile server