Watch.GetConnectTokenEx2
The Watch.GetConnectTokenEx method uses the arguments passed to it to log into the Connect Server and retrieve an authorization token.
Syntax
Watch.GetConnectTokenEx2(host, port, username, password, protocol)
The arguments contain the Connect Server settings (see OL Connect preferences), in the form of strings (host, username, and password) and a number (port); protocol is an integer that can either be 0 (for HTTP) or non-zero (for HTTPS).
Return value
The method returns a JSON structure containing the information about the connection parameters. For example:
{
"host": "localhost",
"port": 1234,
"token": "fdjhfds89r378cm034573890mc3y893r092p",
"method": "basic",
"protocol" : "http",
"tokenExpiration": "Fri, 1 Sep 2023 11:42:33 -0400"
}
where:
-
hostis the host or IP address of the server. -
portis the TCP port number. -
tokenis the authentication token. -
methodis the authentication method; currently, only basic is supported. -
protocolis the protocol used by the server: either “http” or “https”. -
tokenExpirationis the time stamp string representing the expiration time for the token.
Examples
JavaScript
Watch.GetConnectTokenEx2("localhost", 1234, "myUser", "secret");
VBScript
Watch.GetConnectTokenEx2 "localhost", 1234, "myUser", "secret"
Python
Watch.GetConnectTokenEx2("localhost",1234,"myUser","secret");
Perl
$Watch->GetConnectTokenEx2("localhost",1234,"myUser","secret");