0

Trying to figure out why a cookie that was created by postman does not work in rails request.

Here is the structure:

  1. Rest API - web.abc.com/api
  2. website - web.abc.com (Ruby on rails. no JS framework)
  3. Webapp - web.abc.com/admin (ReactJS app)

So now, authentication happens on the (Rails app - website), API then returns a cookie. The cookie is then set in the browser and user is logged in. We then use rails (rest-client) gem and send the cookie back to the API on requests and all works well.

Problem is, the same cookie (session) does not work on the react app. the cookie is sent to the API but does not work. However, if we authenticate using postman, then copy the cookie value and paste it into the browser (cookie value), the react app works BUT not on the website.

So in a nutshell. If the cookie is set from Rails app, it works on the website but not on the react app. If we authorize with postman and past the cookie value in the browser (replacing the cookie value), it does not work on the website, but works on the react app.

what am i missing?

sam
  • 5
  • 1
  • 6
  • not sure if really helpful, but you can have a look here https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain – Maxence Oct 28 '22 at 08:44
  • @Maxence the cookie is created and access on the same domain on different paths, not domain/sub-domain – sam Oct 30 '22 at 05:16

0 Answers0