0

I send a post request to my API located at http://api.board.app.dev:82/api/private/v1/users/current from my emberjs app located at http://www.app.dev:4200/.

The returned data is saved in localestorage but I also want to save token on cookie.

Actually, I do this :

  cookies[:user] = 1
  return { status: 'ok', token: user.authentication_token, email: user.email }

I see the cookie on the response :

enter image description here

But when I go to http://api.board.app.dev:82/api/private/v1/users/current I never see the cookie in the chrome console.

Any idea ?

PaulP
  • 131
  • 1
  • 9
  • What CORS headers do you set, or do you proxy the requests to the backend? – Lux May 14 '16 at 12:15
  • I fixed by setting the token from the JavaScript side. – Florian B May 14 '16 at 12:17
  • You need to set the CORS headers in order for a cookie from `http://api.board.app.dev:82` to be readable from `http://www.app.dev:4200` as one contains a subdomain and they have different ports. – max May 14 '16 at 23:16
  • Possible duplicate of [Cross-Domain Cookies](http://stackoverflow.com/questions/3342140/cross-domain-cookies) – max May 14 '16 at 23:17

0 Answers0