1

How do you work with Angular.js to reuse a session at a webserver (rails) after browser refresh/restart? I'm using RestAngular but I don't know how to store the session? The angular.js app is in my Rails app as a View (with the assets of course) and I have csrf protection fixed.

I want it to work like a regular webpage, where you don't have to log in each time.

kds
  • 28,155
  • 9
  • 38
  • 55
Johan S
  • 3,531
  • 6
  • 35
  • 63

1 Answers1

1

I believe you need to reuse the session objects which is already available in the webserver.

What I would suggest is that, You could use the browser cookie to retrieve the session objects or else you could store a key in the browser DB which you can send to the server via RestAngular and check whether the session is already available. If the session is already there then you can send the relevant data through RestAngular to the browser.

Hope this might help.

kds
  • 28,155
  • 9
  • 38
  • 55
  • I do not have the exact sample code. However, You can go through the below links which you can get some idea on each concepts. html5_webstorage - http://www.w3schools.com/html/html5_webstorage.asp, Browser Cookies handle with ng - http://docs.angularjs.org/api/ngCookies.$cookies, also refer http://stackoverflow.com/questions/10961963/how-to-access-cookies-in-angularjs. I believe you already have worked with RestAngular – kds Nov 08 '13 at 11:36