Authentication
Basic Auth
The recommended way to perform authentication is to use HTTP Basic Auth. If you're using one of the published client API's, you provide your username and password and the client API handles the protocol complexities. For direct REST calls, you will have to add the Authentication header. Code examples are noted below for each supported client.
// direct REST call from Javascript
var username= "[email protected]",
password = "notArealpassword";
var settings = {
"async": true,
"url": "http://gateway.acheck21.com/GlobalGateway/api/v1/checks/default",
"method": "GET",
"headers": {
// this header needs to be set on every REST call.
"Authorization": "Basic " + btoa(username + ":" + password)
},
"processData": false
}
$.ajax(settings).done(function (response) {
console.log(response);
});
var username= "[email protected]";
var password = "notArealpassword";
Client client = new Client("https://gateway.acheck21.com/GlobalGateway");
client.SetBasicAuth(username, password);
ApiClient defaultClient = Configuration.getDefaultApiClient();
defaultClient.setUsername("[email protected]");
defaultClient.setPassword("notArealpassword");
[[ACHConfiguration sharedConfig] username] = @"[email protected]";
[[ACHConfiguration sharedConfig] password] = @"notArealpassword";
Login API
The REST API has an endpoint for direct login to the gateway that will return a cookie that can be used for subsequent authorizations. This is done to circumvent platform limitations. We recommend using this for browser based platforms like Apache Cordova. Examples are only shown for using JavaScript to access the REST endpoints directly and the C# client because they handle the cookie management transparently. Other API clients will require you to manage the cookie.
var settings = {
"async": true,
"url": "https://gateway.acheck21.com/GlobalGateway/api/v1/login",
"method": "POST",
"processData": false
"data" : JSON.stringify({
"username" : "[email protected]",
"password": "notArealpassword"
},
"contentType" : "application/json"
}
$.ajax(settings).done(function (response) {
// you're logged in now. You should be able to
// make requests in the browser context with
// no other authentication required.
})
.fail(function(){
// log in failed.
});
var username= "[email protected]";
var password = "notArealpassword";
Client client = new Client("https://gateway.acheck21.com/GlobalGateway");
client.LoginAsync(new Credentials() { Username = username, Password = password }).Wait();
Updated almost 6 years ago