Authentication
Authentication with Apex is as simple as calling the Login function. If you read the Apex API documentation you can get a better understanding of what is happening under the hood, but the SDK automates nearly everything and makes authentication a breeze.
To authenticate, you can either pass a username and password as individual parameters, or bundle them in a LoginData object and pass that instead.
- Login(username : string, password : string) : Boolean
- Login(login : LoginData) : Boolean
Features of this function are that it:
- Sends the users information to the Apex Server to login.
- Returns false if the password or login are of zero length.
OnLoginSuccess is called when the users information is valid.
OnLoginFailed is called when the users information is not valid or when the server is not able to be reached.
If you want to store authentication information in single LoginData object, simply create a new object and pass the username and password
public LoginData(string username, string password) {
Login = username;
Password = password;
}
Using strings:
ApexSystem.login("[email protected]", "123abc")
Using LoginData:
LoginData PixoLoginData = new LoginData(username:"[email protected]", password:"123abc");
ApexSystem.login(PixoLoginData