Reputation: 7265
I have an angular app hosted with Express, and am using the express-session plugin to generate session cookies.
So on login, I see the session cookie gets generated and sent back to my angular app in the response.
I'm now trying to check for the presence of the cookie in my angular code, but if I try reading document.cookie
I just get an empty sting back, yet I can see the cookie is set looking in my Chrome debugger tools.
I tried using $cookies (I am using angular 1.3 right now), but even that returns undefined if I try $cookies['mycookiename']
Can anyone give me some clues please? Thanks
Upvotes: 0
Views: 215
Reputation: 26
Is your cookie marked HTTP only? If so, the cookie will be unavailable to the JavaScript.
Upvotes: 1
Reputation: 84
This looks like a CORS problem. You need to let the browser know what headers to pass to JavaScript. Configuring Access-Control-Allow-Headers on the server is what you should be looking at.
Upvotes: 0