user session login logout


I’ve been reading the forums and following certain discussions on how best to authenticate and authorize users using the userSessionToken and local storage.

Unfortunately there is no concise explanation of how best to do this.

I suspect that many of us beginning developers would agree that managing a user session to an App is fundamental.

A white paper or tutorial would be appreciated. In my case I would like the user to enter a username and password and press the login button ....loginService handles this.

However, let’s say a user switches apps and once again clicks on the Icon for the app the app should get the userSessionToken from local storage, validate it, through a service (in the forums there is reference to a dummy service for this which sounds write .. is the session is still good it should bypass the login page and go directly to the application to the page that was last displayed to the user (ideally) ... the very minimum the user should not see the login page at all if the session is valid.
(in may case I was trying to do this through the beforeLoad event of the login page ... but so far haven’t got this to work ...
Is the beforeLoad event the correct place to check the userSessionToken for this ?

Then the logout button should invalidate the session and return the user to the login page.

Im still trying to get this to work smoothly.

1 person has
this question