Skip to content

GetID()

ts
var userId = User.GetID();

This method, defined on the User object, returns the user's ID, which is its full username.

WARNING

The current user object may be null when the client session has started but no user has been authenticated yet, so this condition must be checked before using the returned object or any of its methods/properties (see example below).

Example

ts
{
  var user = Session.GetUser();
  if (user !== null) {
    var id = user.GetID();
    Log(id); // will log the user's ID, which is the full username
  }
}