sessionid cannot be found after second logout

0 votes

Hello Shephertz,

I am having a curious problems when logging in and loggin out multiple times: So if I start the app and login/ lougout with :

        userService.Authenticate(nameInputField.textpasswordInputField.text,new LoginCallBack(this)); 

and then logout with 

        userService.Logout(App42API.GetUserSessionId()new LogoutCallBack(this));

Everything goes fine, But if I try to login and then logout again without restarting the app, I get the following when trying to logout:

App42Exception: SessionId can not be null

com.shephertz.app42.paas.sdk.csharp.util.Util.ThrowExceptionIfNullOrBlank (System.Object param, System.String paramName)
com.shephertz.app42.paas.sdk.csharp.user.UserService.Logout (System.String sessionId, App42CallBack callBack)
 
Same error happens if I try to save the sessionId somewhere else, instead of using App42API.GetUserSessionId(). This seems to be an API-bug, since after this error I get the call back, telling me logout was successful:
 
{"app42":{"response":{"success":true,"session":{"userName":"armin65@gmail.com","sessionId":"888225e3-cfb2-4225-ba38-657f58ce94c1","createdOn":"2015-08-14T11:37:58.000Z","invalidatedOn":"2015-08-14T11:38:02.000Z"}}}}
 
help would be much appreciated,
 
armin
 
 
asked Aug 14, 2015 in App42 Cloud API-BaaS by armin65 (39 points)

2 Answers

0 votes
 
Best answer
Ok problem solved, stupid me I was attaching multiple logout functions as listeners to my logout button everytime and wasnt clearing them up after logout.
answered Aug 17, 2015 by armin65 (39 points)
0 votes

Hello Armin.

Thanks for sharing the details with us. See at the time of Logout call, client fails due to the session id which you pass in Logout method call that is null. Please make sure you have login successfully to get the session id in the below function:

App42API.GetUserSessionId();

And, could you please let me know that how and where you are saving the session id. It will help us to provide better support from our end. 

Thanks,

Himanshu Sharma

answered Aug 14, 2015 by hs00105 (2,005 points)
Hi Himahshu,

I have checked the sessionID and it is correct up to the point when Logout is called, but strangely enough when calling logout with App42API.GetUserSessionId(), the sessionId suddenly becomes Null. If I save sessionId in another field (any field, anywhere in my project), the logout function tells me the sessionId is not valid. I get this sessionID from the callback of my login function
Hello Armin,


Please find my answer in line for your query:

Ques:  Session Id suddenly becomes Null?
Ans: Once you call the logout function it will delete the session id of user from local storage that's why you are getting null.

Ques: Session Id is not valid?
Ans: This occurs because you are trying to invalidate the session id which is already invalidated. Please login your user again by using Authenticate method of User Service  to get the new session id and let me know if it helps.

Thanks,
Himanshu Sharma
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...