{"action":"created","issue":{"url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/37","repository_url":"https://api.github.com/repos/jaredpalmer/react-production-starter","labels_url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/37/labels{/name}","comments_url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/37/comments","events_url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/37/events","html_url":"https://github.com/jaredpalmer/react-production-starter/issues/37","id":145935166,"number":37,"title":"Forwarding client's cookies to API when calling from on server","user":{"login":"asadm","id":1973513,"avatar_url":"https://avatars.githubusercontent.com/u/1973513?v=3","gravatar_id":"","url":"https://api.github.com/users/asadm","html_url":"https://github.com/asadm","followers_url":"https://api.github.com/users/asadm/followers","following_url":"https://api.github.com/users/asadm/following{/other_user}","gists_url":"https://api.github.com/users/asadm/gists{/gist_id}","starred_url":"https://api.github.com/users/asadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asadm/subscriptions","organizations_url":"https://api.github.com/users/asadm/orgs","repos_url":"https://api.github.com/users/asadm/repos","events_url":"https://api.github.com/users/asadm/events{/privacy}","received_events_url":"https://api.github.com/users/asadm/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-04-05T09:30:31Z","updated_at":"2016-04-06T18:54:03Z","closed_at":null,"body":"Sorry if this is a noob question. What happens when the API call needs user's session. I assume those session cookies won't be forwarded to the API endpoint when the rendering happens on server-side? \r\n\r\nAny idea on how should I forward user's cookies to the API endpoint. I think it will be somewhere inside HttpClient.js?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/comments/206512394","html_url":"https://github.com/jaredpalmer/react-production-starter/issues/37#issuecomment-206512394","issue_url":"https://api.github.com/repos/jaredpalmer/react-production-starter/issues/37","id":206512394,"user":{"login":"asadm","id":1973513,"avatar_url":"https://avatars.githubusercontent.com/u/1973513?v=3","gravatar_id":"","url":"https://api.github.com/users/asadm","html_url":"https://github.com/asadm","followers_url":"https://api.github.com/users/asadm/followers","following_url":"https://api.github.com/users/asadm/following{/other_user}","gists_url":"https://api.github.com/users/asadm/gists{/gist_id}","starred_url":"https://api.github.com/users/asadm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asadm/subscriptions","organizations_url":"https://api.github.com/users/asadm/orgs","repos_url":"https://api.github.com/users/asadm/repos","events_url":"https://api.github.com/users/asadm/events{/privacy}","received_events_url":"https://api.github.com/users/asadm/received_events","type":"User","site_admin":false},"created_at":"2016-04-06T18:54:03Z","updated_at":"2016-04-06T18:54:03Z","body":"I kinda solved it this way:\r\nFirst, when user requests the page from express server. The ```req``` holds any session cookies in it's header. I just forward ```req.headers.cookie``` down till HttpClient.js:\r\n\r\n```javascript\r\nget: (cookies, path) => new Promise((resolve, reject) => {\r\n    request\r\n      .get(getUrl(path))\r\n      .accept('application/json')\r\n      .set(\"Cookie\",cookies)\r\n      .end((err, res) => {\r\n        if (err) {\r\n          if (err.status === 404) {\r\n            resolve(null);\r\n          } else {\r\n            reject(err);\r\n          }\r\n        } else {\r\n          resolve(res.body);\r\n        }\r\n      });\r\n  }),\r\n```\r\n\r\nDoes this make sense?"}}