EDIT: Re-wrote the question to be more general and focus on the core problem.
I've made a chrome extension that allows a user to play a mobile game in chrome. This is possible since the game is web-based.
Essentially what the extension does is:
- sends an ajax POST request with the user id
- the request returns a session id
- open a new tab to a particular url passing the session id as a param
- the page is then redirected to the game home page on successful authorization
- otherwise, redirects to an error page
When I try to replicate this in Node.js:
- I use request to send the POST request with the user id
- the request returns a session id
- I send a GET request to a particular url passing the session id as a param
- the request returns with a status 500 response
- It appears that the response body is the error page
I used a cookieJar (request.jar()) to handle the cookies/session, but I can't get it to work the same way the browser does it.
Any ideas?