Skip to content

GetID()

ts
GetID(): string;

Returns the user's ID, which is their full username.

WARNING

The User object may be null if no user has been authenticated yet. Always check for null before using the object or any of its methods or properties (see example below).

Example

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