robisim74 / AngularSPAWebAPI

Angular Single Page Application with an ASP.NET Core Web API that uses token authentication
MIT License
231 stars 59 forks source link

Session time question #15

Closed garkuwa closed 7 years ago

garkuwa commented 7 years ago

Hi,

I wondered if there is any logic for configuring session time. I would like to make session 20 minutes and logout user, if user didn't show any activity during this 20 minutes. As I understand, I might configure it thru scheduleTokenRefresh() and unscheduleRefresh() with additional logic. Please correct me if I'm wrong.

Best regards, Taras

robisim74 commented 7 years ago

Hi Taras,

unscheduling is easy: just call unscheduleRefresh method, or rather, signout method, otherwise the user remains authenticated until the token expires. The logic to track the user's activity there isn't in this sample: I think you could use a library like this: https://github.com/HackedByChinese/ng2-idle

garkuwa commented 7 years ago

Thanks a lot for a quick reply!