Hi there -
I'm running into a lot of NotAuthenticated errors on Kongregate. I read this post and added handling for when these errors occur - whenever the error is raised, the game attempts to re-authenticate with PlayFab. In spite of this, issues continue arising, in response to the UpdateUserData request (which is what the save game function does).
Any ideas? Aside from being a major pain to the users, it also stops me from implementing hard currency rewards, as I'd like those to be managed by the server - which is problematic if I cannot rely on the server correctly crediting the reward due to an authentication issue
public static void SaveGameOnline(Action<bool> callback) { GetServerTime((time) => { Debug.Log("Received server time of " + time.Time.TimeOfDay); UpdateUserDataRequest request = new UpdateUserDataRequest { Data = SaveGameManager.GetSaveData(time.Time.Ticks) }; PlayFabClientAPI.UpdateUserData(request, (result) => { callback?.Invoke(true); }, (error) => { callback?.Invoke(false); OnSaveGameError(error); }); }); } public static void GetServerTime(Action<GetTimeResult> callback) { PlayFabClientAPI.GetTime(new GetTimeRequest(), (result) => callback?.Invoke(result), (error) => { if (error.Error == PlayFabErrorCode.NotAuthenticated) { ReauthenticateUser(); } }); } private static void OnSaveGameError(PlayFabError error) { if (error.Error == PlayFabErrorCode.NotAuthenticated) { ReauthenticateUser(); } if (error.Error == PlayFabErrorCode.EntityTokenExpired) { ReauthenticateUser(); } } private static void ReauthenticateUser() { var kongregateLoginRequest = new LoginWithKongregateRequest { KongregateId = kongregateID, AuthTicket = kongregateAuthTicket, CreateAccount = false }; PlayFabClientAPI.LoginWithKongregate(kongregateLoginRequest, null, null); }