Jahmarley
Posts: 0
Joined: Mon Apr 16, 2012 8:21 pm

Unable to get the logout service to function as it should

I have completed the sign up and log in services from the pre done Tiggzi Database services feature.

The upload a file to Tiggzi Database tutorial assisted me in completing this. However, there is no tutorial to follow in order to complete the logout service and I am unable to get it done.

*************************

I have created new database service logout (named it logoutservice)... and added to the app page. I have added event - on click - invoke service (logoutservice). When I go to map the service, under request mapping... X-Tiggzi-Session-Token is available for mapping and I map it to local storage (_sessionToken). However, when I click on the sign out link after signing in, it doesnt work so I figure i'm missing a step or doing it wrong.

In the below image... I have taken a screenshot of the UI. showing the session token '6abd9e22-2b31-4fc1-8318-4fc072c4ed5b' read from localstorage. This token is showed before and after the logout service is invoked and I am unable to logout of the app

So I know i'm not doing something correct. Please assist.

Image

logout service mapping...

Image

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

Unable to get the logout service to function as it should

Hello!

What do you mean?
[quote:]
"However, when I click on the sign out link after signing in, it doesnt work"
[/quote]
SignOut click works in your project normally.

After logout service is run, local variable _sessionToken doesn't change. But server does not accept the variable value as valid. This means session token becomes invalid.

Jahmarley
Posts: 0
Joined: Mon Apr 16, 2012 8:21 pm

Unable to get the logout service to function as it should

Ty much Katya.

My issue might be my code then. I run the following codes on page load for the sign in, sign out, profile and users buttons in the bottom navbar in order to make them enabled depending on whether a user is signed in or not...

Image

****************************

var session = localStorage.getItem('sessionToken');
var button = Tiggzi('navbar_footer_signin');
if (session =='' || session == null ){
button.removeClass('ui-disabled');
}
else {
button.addClass('ui-disabled');
}

****************************

var session = localStorage.getItem('_sessionToken');
var button = Tiggzi('navbar_footer_signout');
if (session =='' || session == null ){
button.addClass('ui-disabled');
}
else {
button.removeClass('ui-disabled');
}

******************************

etc.

However, when I invoke the logout service by clicking on the SignOut button... the state of the buttons do not change.

Can u assist further please?

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

Unable to get the logout service to function as it should

Please correct your code mistake changing 'sessionToken' to '_sessionToken'.

Next, _sessionToken variable must be set to empty string after logout RESTService finishes successfully.
You can do it by adding event on success and action 'Set local storage variable'.

After all, use your code to update buttons state.

Return to “Issues”