Login

The Login class in the .NET Standard OAS Data API provides authentication methods for connecting to OAS instances with a set of specific credentials when using the Data class methods.

Info

The methods provided by this class can be called directly on the Data class.

Namespaces

OASData.Login

Methods

CurrentUser

Returns the current username.

If no user is logged in it will return an empty string.

Signatures:

public string CurrentUser()

Returns:

  • string: Returns the current user if logged in, otherwise empty string.

Example:

var login = new Login();
login.LogIn("api", "my_password");

var currentUser = login.CurrentUser();
// result = "api"
LogIn

Login with the given username and password.

Signatures:

public string LogIn(string UserName, string Password)
public string LogIn(string UserName, string Password, string NetworkNode)
public string LogIn(string UserName, string Password, string NetworkNode, string RemoteSCADAHostName)

Parameters:

  • UserName (string): User username
  • Password (string): User password
  • NetworkNode (string): OAS node IP or hostname
  • RemoteSCADAHostName (string): Registered Live Data Cloud hosting name

Returns:

  • string: Result string

Example:

var login = new Login();

var result = login.LogIn("api_username", "api_password");
// result = "Success"
LogOff

Logout the currently logged in user.

Signatures:

public void LogOff()

Example:

// Assume login was done somewhere else
// var login = new Login();
// login.LogIn("api_username", "api_key");

login.LogOff();
SetUserName