Session With Webapi's and angularjs

89 views
Skip to first unread message

DASA ANUDEEP

unread,
Nov 3, 2015, 6:54:50 PM11/3/15
to AngularJS
Hi Team,

I am facing one weird issue for my project.
After going through so many links for session i went with ngIdle provider, below is config code.

IdleProvider.idle(900);
IdleProvider.timeout(300);
KeepaliveProvider.interval(300); 

Idle.watch();

Webapi's resides in same domain and if i was idle for 10mins and then if i make any calls to webapi then i get aborted status.

when i investigate further and found some info:
session alive is not happening at client side and server is waiting for 10 mins, after that it aborted and not even calling webapi.

please suggest me what is best way to handle session for angualrjs with webapi's.

Sander Elias

unread,
Nov 4, 2015, 2:25:16 AM11/4/15
to AngularJS
Hi Dasa,

I'm assuming you are talking server-side now? The problem you are describing is not angular related, but SPA related. If you really need sessions( switching to a jwt token is much more maintainable and scalable!), you should not be relying on the client. A better option would be, time the interval between api-calls, and use that.

Regards
Sander

Vaibhav Gupta

unread,
Nov 6, 2015, 12:25:59 AM11/6/15
to AngularJS
Hi,

I am not sure about your use case but this is what we follow in our product:

1. For a user who has not logged in, we maintain a heart beat which revives the session on server by sending a dummy request.
2. For a user who is not logged in, we show him/her a warning message that session is about to timeout. If no action is taken then we logout the user.

I hope this gives you a direction.

DASA ANUDEEP

unread,
Nov 6, 2015, 1:21:02 AM11/6/15
to AngularJS
Thank You, finally i found out root cause. we are using ACS login that is causing cors issue because it's other domain and that session is 10 mins.

DASA ANUDEEP

unread,
Nov 6, 2015, 1:21:47 AM11/6/15
to AngularJS
Thank You, finally i found out root cause. we are using ACS login that is causing cors issue because it's other domain and that session is 10 mins.

Reply all
Reply to author
Forward
0 new messages