0
votes

I have a login module and and now I want to logout. So how can I maintain session on client side. Is there any method in worklight for this? How can I generate session id for this on client side?

please help me out.

1
can anyone plz help.. - user3747168
Are you using custom login module? Did you tried WL.Client.Logout(realm) to logout and to get the client side session and session ID AFAIK there is no worklight javascript client side API. but you can verify by using WL.Client.getLoginName(realm) - Bluewings
@Bluewings I have server side request for login. Can you plz give mi example of WL.Client.Logout(realm) method - user3747168
WL.Client.logout("yourrealmname",{ onSuccess: successCallback, onFailure: failureCallback }); you can find more in this link - Bluewings

1 Answers

-1
votes

You can use prefrence ... First save user id while login like this

    prefs.edit().putString(Constants.PREF_EMAIL, userName).commit();

and when next time while launching app do this....

    String email = prefs.getString(Constants.PREF_EMAIL, "guest");
    String password = prefs.getString(Constants.PREF_PASSWORD, "guest");


    if(!email.equalsIgnoreCase("guest") )
    {
    }
   else
    {
    }

Hope this will help u...