Session Id is not valid while do post scores with FacebookToken (Unity SDK)

0 votes

Hi !

I have a problem with posting data to cloud.

Here is the code I use

        App42API.Initialize(GameSettings.App42ClientApiKey, GameSettings.App42ClientSecretKey);
        App42Log.SetDebug(true);
 
        ScoreBoardService scoreBoardService = App42API.BuildScoreBoardService();
 
        scoreBoardService.SetFbAccessToken(FB.AccessToken);
        scoreBoardService.SaveUserScore(string.Format("g_{0}_{1}", 0, 0), FB.UserId, -1000,
            new App42GameCb((o) =>
            {
                Game game = (Game)o;
                LogLog.Log("Success submiteed moves: total record = " + game.GetTotalRecords());
            }, (e) =>
            {
                LogLog.Error("Unable to submit score: " + e.Message);
            }));
 
 
And have this in Unity Log:
 
Unable to submit score: {"httpErrorCode":"400", "appErrorCode":"2207", "message":"BAD REQUEST", "details":"Session Id not valid"}
UnityEngine.Debug:LogError(Object)
LogLog:Error(String) (at Assets/IntUtils/DebugTools/Scripts/LogLog.cs:19)
TestSocialApi:<testSubmitData>m__87(Exception) (at Assets/Scripts/Test/TestSocialApi.cs:110)
App42GameCb:OnException(Exception) (at Assets/Scripts/Social/App42GameCb.cs:21)
com.shephertz.app42.paas.sdk.csharp.connection.<execute>d__6:MoveNext()
com.shephertz.app42.paas.sdk.csharp.connection.<WaitForRequest>d__3:MoveNext()
 
----
Have no idea what could be wrong, because same code had worked for me 1-2 days ago, but today it doesn't.
 
Any help ?
 
asked Oct 8, 2014 in App42 Cloud API-BaaS by Vyacheslav Sidin (11 points)

1 Answer

0 votes

Well, I asked and I found out the reason.

When I run the code on the device it was working, but on Unity Editor was not working.

After compare logs I found out that on Unity version when I do request to scoreBoardService along with facebook token it sends session id. Don't know why, probably id session was stored before when code was worked with session module but now it does not use sessions at all. So basically what I do, is before

App42API.Initialize(GameSettings.App42ClientApiKey, GameSettings.App42ClientSecretKey);

I put: 

 

PlayerPrefs.DeleteKey("SessionId"); 

App42API.Initialize(GameSettings.App42ClientApiKey, GameSettings.App42ClientSecretKey);

 

after this, the code was started to work on unity editor too.

Looks like mixing authorize approach "facebook" vs "user-session" in the same application does not play well.

Hope it helps to someone with similar problem.

 

 

 

answered Oct 8, 2014 by Vyacheslav Sidin (11 points)
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
...