Page 1 of 1

token verification question

Posted: Mon Jul 07, 2014 9:22 pm
by casey palmer

Hello, Currently I am verifying the user token on the page load and page show events. If event is returned unsuccessful it navigates the user to the Sign In page. To test I clear the Token that is stored in local storage and then try to bypass the login page, the page I navigate to will show for a second or 2 then I will be taken to the Sign In page. This is as expected with no valid token and seems to work. My question is how would you suggest to manage this check better and on what event would be best? If user tries to bypass the login screen and go directly to another page I would like for the page to not show at all, even for a sec, before the user is taken to the sign in page. Thank you for any suggestion.


token verification question

Posted: Mon Jul 07, 2014 10:15 pm
by Yurii Orishchuk

Hi Casey,

Your verification processing is ok.

But you can make some improvement:

1 On success event for logout service you need to clear/delete your token LSV with following JS code:

pre

localStorage.removeItem("sessionToken");

/pre

2 Create new JS and fill it with following code:

pre

//Note: replace "sessionToken" with your token name.
var token = localStorage.getItem("sessionToken");

if(!token){
//Navigate to signIn screen if token not defined
Apperyio.navigateTo("signInScreen");
};

/pre

Also if you need to test every time you invoked the service whether token is ok you can:
use "generic security context" - and check in this client proxy where every request has correct response. And if not - navigate to signIn page.

See more about it here: http://devcenter.appery.io/documentat...

Regards.