App42 2207 Problem-Acl enabled app

0 votes
Hi All

I test my game and login to app42 with a username in unity editor. Then I build it to a phone and again login with same username. After a while I test in editor again I get 2207-Session Id not valid error. But after I delete player prefs, I do not get that error. What is wrong here?:) What could be changing after I delete player prefs? What should I do for this problem?

Thanks
asked Sep 21, 2016 in Unity by gokhan (20 points)

1 Answer

0 votes
Hi Gokhan,

Could you please provide the code snippet of our API which you are using to login your app? It will help us understand the problem.

Regards,

Rajeev
answered Sep 21, 2016 by rajeev.etc (1,660 points)
Hi Rajeev
This is the code snippet for login. As I said my app is acl enabled.

Dictionary<String, String> otherMetaHeaders = new Dictionary<String, String>();
otherMetaHeaders.Add("userProfile", "true");
UserService userService = App42API.BuildUserService();
userService.SetOtherMetaHeaders(otherMetaHeaders);
Query query = QueryBuilder.Build("_$owner.owner",userName, Operator.EQUALS);
userService.SetQuery("UserData", query);  
userService.Authenticate(userName, pass,new AuthCallback());

I get 2207 error while I call these as well:

string currentTime = GameUtility.GetUTCFormattedTimestamp (UserSessionScript.Instance.currentServerTime);
Query q1 = QueryBuilder.Build("StartDate",currentTime, Operator.LESS_THAN);
Query q2 = QueryBuilder.Build("EndDate",currentTime, Operator.GREATER_THAN_EQUALTO);
Query query = QueryBuilder.CompoundOperator(q1, Operator.AND, q2);
App42API.BuildStorageService().FindDocumentsByQuery("WOODBALL","SeasonData",query, new RetrieveSeasonInfoCallBack());
Hi Gokhan,

Could you please print the complete logs of method and share with us on support@shephertz.com.

To print the internal logs, put the below line of code just after the key initialization:

App42Log.SetDebug(true);

Regards,
Himanshu Sharma
I have send an email.
This is happening because when you login again either on same device or on different device with same user credential it resets the sessionID and invalidate the previous sessionID.

In your case, when you are trying to fetch the docs, the sessionID saved on this device has been expired as you have already login with same credentials on different device and got new sessionID for that user. Hence, you can fetch the data with newly generated sessionId only.

What you can do is whenever you get this error code, you can fire session time-out message and ask user to login again.

Please let me know if you have any queries.
Hi Rajeev
Thanks for your answer. You said "whenever you get this error code, you can fire session time-out message and ask user to login again." but when I try to call: userService.Authenticate(userName, pass,new AuthCallback()); it still fires 2207 error. Should I delete player prefs before I call new login?
Also, is this the only way of solving this scenario(I mean try to login with same username on different devices)? I tested this scenario on another game. What it does is: at the time of I login on another device, it shows an UI on previously logged device that saying "You cannot login on different devices".
Hi Rajeev
I have two question regarding this question:
1-)When I debug Exception e, it says com.shephertz.app42.paas.sdk.csharp.App42Exception: {"httpErrorCode":"400", "appErrorCode":"2207", "message":"BAD REQUEST", "details":"Session Id not valid"} But When I debug ApperrorCode it prints 0. So I cannot check whether it is 2207 or not. How this can be happen?
2-)You said above ask user to login again. But once I get 2207 error code, I cannot call authonticate API as well. So how can a user login again?
By the way I am using version 4.1.2
Any one here?
Hi Gokhan,

Let's have a call to fix this issue in one go. Please send your available timings to Aidityo so that he schedule the same.

Regards,
Rajeev
Rajeev
I am available now. Can we please arrange it. I wrote to Aidityo but he is not available at the moment at skype.
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
...