0

I'm trying to save user in a session using

session[:user_id] = user_id # comes from ionic via get

but when i'm trying to send another $http.get request, I'm getting:

ActionDispatch::Request::Session:0x7fa8882b2ae0 not yet loaded # when I print session
nil # when I print session[:user_id]

If I run it from my android device it works fine.

Also tries to give it expired_at but still no luck.

Headers:

Access-Control-Allow-Credentials:true
Access-Control-Allow-Methods:GET, POST, OPTIONS
Access-Control-Allow-Origin:http://localhost:8100
Access-Control-Max-Age:1728000
Cache-Control:max-age=0, private, must-revalidate
Connection:close
ETag:W/"b8f8b488bd2e233c017c98f592099e7b"
Server:thin
Set-Cookie:_MyAppServer_session=REVtSTJMYXR0TDRSVSs0VEdvNEF3a2RjR21Hei8wRFBpdFkyR3VOQTgyeXNLNGFvYjdsWjFudG9MNk51NkR2Y25DMUFmL1RsZUhmdHhUeUxTSnJPcHc9PS0tUHlTS3BYT1VOMnFSem4zS1JaeGErUT09--de9f966344e4e90810e428f53bd6cf2783ccf835; path=/; HttpOnly

Vary:Origin

Shalev Shalit
  • 1,945
  • 4
  • 24
  • 34

1 Answers1

1

I add $http.defaults.withCredentials = true; to the ionic js.

XmlHttpRequest CORS POST sent without cookies

Community
  • 1
  • 1
Shalev Shalit
  • 1,945
  • 4
  • 24
  • 34