Skip to content

AuthenticateUserFromScript()

ts
AuthenticateUserFromScript(): void;

Forcefully authenticates a user from within a script. Even if the user has failed authentication, typed the wrong password, or used the wrong key, this function will force a successful authentication.

CAUTION

This function should only be used inside an OnAuthRequest event-handler.

Example

ts
{
  if (Session) {
    // Force authentication for a specific user (use with caution!)
    if (YourOwnCustomAuthFunction(Session.GetUserID())) {
      Session.AuthenticateUserFromScript();
      Log("User forcefully authenticated by script.");
    }
  } else {
    Log('Session object is not available.');
  }
}