Issues an async Http POST to the authentication endpoint (/token). Returns (Task<Tuple<System.Boolean, System.String, System.String».)Exception Type: ArgumentExceptionfullUserName must match the Regex pattern ^((?[a-zA-Z0-9_.-]*)\)?(?[a-zA-Z0-9_.-]{2,})$Exception Type: FailedOutcomeException
Log in to the software using this method.
Name | Description |
---|---|
instanceName | The Login name of the Instance (must be a globally unique value). |
fullUsername | The user name. Must be unique within the instance. May include an instance prefix, if the logging into from a trusted (parent) instance. I.E. instanceName\username. |
password | The password. |
newPassword | Optional parameter, used to supply a new password for a valid user, when the user must change password on next login. |
onetimePassword | Optional parameter, used if the user has enabled Two Factor Authentication. |
sendOnetimePassword | if set to true and a valid Instance name, username, and password have been provided, then a One Time Password will be calculated and sent by SMS text to the Mobile phone of the user. |
Example in C#
// Returns: String
var item = await client.LoginAsync(String instanceName, String fullUsername, String password, String newPassword, String onetimePassword, Boolean sendOnetimePassword);
Example in CURL
curl -X POST \
https://api.us.acresecurity.cloud/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'grant_type=password&client_id=consoleApp&client_secret=consoleSecret&username=INSTANCE.COMMONNAME%5CYOURUSERNAME&password=YOURPASSWORD&instance=INSTANCE.COMMONNAME&sendonetimepassword=false'
This example shows how to use the LoginAsync to determine if the user has enabled two factor authentication, and if so, then how to request a one time password be sent to the user via SMS text.
Example in C#
var client = new Client("https://api.us.acresecurity.cloud");
var result = await client.LoginAsync(instance, username, password);
if(result.Item1 == false && result.Item2 == "one_time_password_required")
{
result = await cient.LoginAsync(instance, username, password, sendOnetimePassword:true);
// Wait for user to enter one time password then login again
result = await client.LoginAsync(instance, username, password, onetimePassword:userEnteredValue);
}