Page 1 of 1

user session login logout

Posted: Wed May 14, 2014 2:44 pm
by Doo Dad

Hi

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 Appery.io 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.

Thanks
DD


user session login logout

Posted: Wed May 14, 2014 3:26 pm
by Evgene Karachevtsev

Hello,

Yes, you can do it on event "before show". Also, you can use approach with appery.io server code: https://getsatisfaction.com/apperyio/...


user session login logout

Posted: Thu May 15, 2014 11:02 am
by Doo Dad

Thanks for the Link .. its a little confusing with all the questions and comments
within the thread ... not clear what works and what doesn't work

Something more definitive like a White-paper or actual tutorial would better serve this.

DD


user session login logout

Posted: Thu May 15, 2014 11:21 am
by Kateryna Grynko

Hi,

Thank you for the feedback, I'll pass your suggestion.


user session login logout

Posted: Tue Jan 13, 2015 2:00 am
by Mike Azar

I'm trying to use BeforeLoad but it is not responding!
What is the purpose of "BeforeLoad"?
When does it get fired?

This is what I have on a start page under "BeforeLoad".

if (localStorage.UserID)
{
Apperyio.navigateTo("ToDo_List");
}


user session login logout

Posted: Tue Jan 13, 2015 2:03 am
by Mike Azar

Where do you find "BeforeShow?
I'm looking for it under Page Events.


user session login logout

Posted: Tue Jan 13, 2015 5:23 am
by Yurii Orishchuk

Hi Mike,

This is jqm events and you can find more info here: http://www.w3schools.com/jquerymobile...

Regards.


user session login logout

Posted: Wed Jan 14, 2015 4:04 am
by Mike Azar

What I mean is the appery.io BeforeLoad event...

Image


user session login logout

Posted: Wed Jan 14, 2015 8:28 am
by Evgene Karachevtsev

Hello Mike,

Unfortunately it's a bug, we reported it and will get back to you with the update when we have any new from our development team.


user session login logout

Posted: Fri Jul 31, 2015 2:00 am
by Yurii Orishchuk

Hi Mike,

I've checked it and unfortunatly it's a bug. We are posted and will respond you about any update here.

Also here is a workaround to handle this event:

1 Add new JS asset.

2 Populate it with following JS code:

pre

$(function(){
var onPagebeforeload = function(){
//Here you should do things to lock the page.
console.log("Before transiion");
};
jQuery("body").bind("pagebeforeload", onPagebeforeload);

});

/pre

Regards.