0

I am interested solely in what happens with the userinfo if a player is not signed into their Kongregate, I need to check for this as I will be saving game progress on a server and of course I don't want to be writing random save records into my database that will never actually be used.

My code is as follows

public void OnKongregateAPILoaded(string userInfoString)
{
    var info = userInfoString.Split('|');
    var userId = System.Convert.ToInt32(info[0]);
    var username = info[1];
    var gameAuthToken = info[2];
    Debug.Log("Kongregate User Info: " + username + ", userId: " + userId);
}

More specifically what I'm asking for is, will something such as username return null? Or something in general that I can check for?

AlexJBallz
  • 77
  • 6

1 Answers1

0

Username changes to: "Guest" Id changes to: 0

AlexJBallz
  • 77
  • 6
  • Checking the username and userId to determine this is not officially documented. You should use the [`services.isGuest()`](https://docs.kongregate.com/docs/client-api-services-isguest) method to check this instead. See [handling guests](https://docs.kongregate.com/docs/concepts-handling-guests). – Patrick Roberts Aug 14 '18 at 17:43
  • I didn't even think about adding that to the jslib, thank you – AlexJBallz Aug 15 '18 at 00:16