Login
Before using the functions on this page, you may find it useful to review the following information:
The list of all functions is here.
Description of this function | Ability to log in with an account (email address and password) |
---|---|
List of functions |
|
/service/login
function
In the code sample below the /service/login
endpoint is called with arguments email
and password
. The result returned contains a boolean Success
field. If false then the reason is returned in a Message
field.
The other parameter returned is Uuid
, which is the unique id for this session. Note that cookies are not used for session management, thus avoiding various cookie-related attacks such as XSS or XSRF. Instead, the Uuid
value must be used for all further requests.
The login creates a session. The session will remain active as long as any API calls are made within a 20-minute period.
function OnLogin() {
var email = $('#email').val();
var password = $('#password').val();
$("#loginmessage").html("...");
$("#sessionguid").html("");
$.ajax({
url: '/Service/Login',
type: 'POST',
contentType: 'application/json',
data: JSON.stringify({ email: email, password : password }),
dataType: 'json',
success: function (result) {
if (!result.Success) {
$("#loginmessage").html(result.Message);
}
else {
$("#resultjson").html("");
_uuid = result.Uuid;
$("#loginmessage").html("Success");
$("#sessionguid").val(result.Uuid);
}
}
});
}