user session login logout

This forum contains topics that were moved from Get Satisfaction
Doo Dad
Posts: 0
Joined: Sun May 11, 2014 8:04 pm

user session login logout

Post 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

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

user session login logout

Post 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/...

Doo Dad
Posts: 0
Joined: Sun May 11, 2014 8:04 pm

user session login logout

Post 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

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

user session login logout

Post by Kateryna Grynko »

Hi,

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

Mike Azar
Posts: 0
Joined: Sun Dec 28, 2014 2:19 am

user session login logout

Post 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");
}

Mike Azar
Posts: 0
Joined: Sun Dec 28, 2014 2:19 am

user session login logout

Post by Mike Azar »

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

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

user session login logout

Post by Yurii Orishchuk »

Hi Mike,

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

Regards.

Mike Azar
Posts: 0
Joined: Sun Dec 28, 2014 2:19 am

user session login logout

Post by Mike Azar »

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

Image

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

user session login logout

Post 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.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

user session login logout

Post 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.

Post Reply