31 May 2013

AngularJs Cookies with Play Framework 2.1.1 Java Session.

I have been working with AngularJs and I loved it, but occasionally I ran into some problems and the documentation is not that reliable. So, I’m helping them to increase the rank.

Recently, I have this problem when Play saved some session in cookie already, but I can’t use $cookies from AngularJs to read the cookie. So, I started digging in and I found that those cookies are set with httpOnly by default. If you have that flag on any plugins (e.g, AngularJs) cannot read that cookie. So, it Play 1 you can set application.session.httpOnly=false but in Play 2.1 they changed to session.httpOnly=false

I’m hoping I can save some people’s time.

Til next time,
noppanit at 00:00