{"action":"created","issue":{"url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/33","repository_url":"https://api.github.com/repos/joeferraro/react-native-cookies","labels_url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/33/labels{/name}","comments_url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/33/comments","events_url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/33/events","html_url":"https://github.com/joeferraro/react-native-cookies/issues/33","id":163752269,"number":33,"title":"Cannot read cookies set in react-native from rails server","user":{"login":"obromios","id":1390233,"avatar_url":"https://avatars.githubusercontent.com/u/1390233?v=3","gravatar_id":"","url":"https://api.github.com/users/obromios","html_url":"https://github.com/obromios","followers_url":"https://api.github.com/users/obromios/followers","following_url":"https://api.github.com/users/obromios/following{/other_user}","gists_url":"https://api.github.com/users/obromios/gists{/gist_id}","starred_url":"https://api.github.com/users/obromios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obromios/subscriptions","organizations_url":"https://api.github.com/users/obromios/orgs","repos_url":"https://api.github.com/users/obromios/repos","events_url":"https://api.github.com/users/obromios/events{/privacy}","received_events_url":"https://api.github.com/users/obromios/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-04T23:53:46Z","updated_at":"2016-08-14T22:10:14Z","closed_at":null,"body":"I have asked the following [question](http://stackoverflow.com/questions/38092028/cannot-read-cookies-set-by-ios-from-rails-server) on stack overflow with no answer, so am asking here.\r\nI am using [react-native-cookies][1]. I can use the getAll method to read cookies that have been previously set on the server side. In react native I can use the set command to set a cookie called 'myCookie', and I can read it using the getAll command. However, I cannot read a cookie on the server side that has been set by the react-native app.\r\n\r\n  [1]: https://github.com/joeferraro/react-native-cookies\r\n\r\nThe react-native code which is in ```index.ios.js```\r\n\r\n    var CookieManager = require('react-native-cookies')\r\n      componentWillMount () {\r\n        CookieManager.set({\r\n          name: 'myCookie',\r\n          value: 'myValue',\r\n          domain: 'ios app',\r\n          origin: 'some origin',\r\n          path: '/',\r\n          version: '1',\r\n          expiration: '2017-05-30T12:30:00.00-05:00'\r\n        }, (err, res) => {\r\n          console.log('cookie set!');\r\n          console.log(err);\r\n          console.log(res);\r\n          console.log('my output');\r\n        });\r\n        CookieManager.getAll((cookie) => {\r\n          let isAuthenticated;\r\n          if (cookie && cookie.remember_token) {\r\n            isAuthenticated = true;\r\n          }\r\n          else {\r\n            isAuthenticated = false;\r\n          }\r\n    \r\n          this.setState({\r\n            loggedIn: isAuthenticated\r\n          });\r\n          console.log('GM:cookie remember isAuthenticated', cookie.remember_token, isAuthenticated,this.state.title,'myCookie',cookie.myCookie)\r\n        });\r\n      },\r\nThe output from the last console log message is\r\n\r\n    GM:cookie remember isAuthenticated Object {domain: \"localhost\", value: \"BAhbB2kHSSJFZmM3NDVkNTEwZTBkYTViZjU4NTJhOGQyZDNlMz…wY6BkVU--5888c15b42c6bdf3ca34c89f6554d2455d48c46b\", name: \"remember_token\", path: \"/\"} true Sign In myCookie Object {domain: \"ios app\", value: \"myValue\", name: \"myCookie\", path: \"/\"}\r\n\r\nshowing that the myCookie object is being set and that the app is able to recover the remember_token set by the rails server.  \r\n\r\nThe above code is executed at start up of the ios app. The ios app then opens a webview component that calls the new method in the sessions controller of a ruby on rails web app.  In the rails sessions controller, I find that ```cookie['myCookie']``` is ```nil```.  Why is the cookie being set in a way that I cannot access it from the rails app?\r\n\r\nSomeone has suggested dropping the optional keys like domain and origin, but react-native-cookie appears to require all these keys. I have also tried setting the domain to the correct domain name and that does not help either.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/comments/239700890","html_url":"https://github.com/joeferraro/react-native-cookies/issues/33#issuecomment-239700890","issue_url":"https://api.github.com/repos/joeferraro/react-native-cookies/issues/33","id":239700890,"user":{"login":"obromios","id":1390233,"avatar_url":"https://avatars.githubusercontent.com/u/1390233?v=3","gravatar_id":"","url":"https://api.github.com/users/obromios","html_url":"https://github.com/obromios","followers_url":"https://api.github.com/users/obromios/followers","following_url":"https://api.github.com/users/obromios/following{/other_user}","gists_url":"https://api.github.com/users/obromios/gists{/gist_id}","starred_url":"https://api.github.com/users/obromios/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obromios/subscriptions","organizations_url":"https://api.github.com/users/obromios/orgs","repos_url":"https://api.github.com/users/obromios/repos","events_url":"https://api.github.com/users/obromios/events{/privacy}","received_events_url":"https://api.github.com/users/obromios/received_events","type":"User","site_admin":false},"created_at":"2016-08-14T22:10:14Z","updated_at":"2016-08-14T22:10:14Z","body":"Unfortunately no."}}
{"actor":{"display_login":"obromios"}}