Introduction
Remote Login API, allows automated login and redirection to whichever environment is specified in as the endpoint (See endpoint list for environments).
We have language bindings in Shell, Javascript and Java! You can view code examples in the dark area to the right, and you can switch the programming language of the examples with the tabs in the top right.
Authentication
To authorize, use this code:
var data = "username=<USERNAME>&password=<PASSWORD>";
var xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
window.location = this.responseText;
}
});
xhr.open("POST", "<ENDPOINT>");
xhr.setRequestHeader("content-type", "application/x-www-form-urlencoded");
xhr.setRequestHeader("remote-login", "true");
xhr.send(data);
public class RemoteLogin {
private final static String endpoint = "<ENDPOINT>";
private OkHttpClient client = new OkHttpClient();
public Response login(String user, String pass) {
String credentials = "user=" + user + "&pass=" + pass;
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, credentials);
Request request = new Request.Builder()
.url(endpoint)
.post(body)
.addHeader("content-type", "application/x-www-form-urlencoded")
.addHeader("remote-login", "true")
.build();
Response response = client.newCall(request).execute();
}
}
curl --request POST \
--url <ENDPOINT> \
--header 'content-type: application/x-www-form-urlencoded' \
--header 'remote-login: true' \
--data 'username=<USERNAME>&password=<PASSWORD>'
Make sure to replace
<USERNAME>&<PASSWORD>with the users actual credentials, and<ENDPOINT>with one for the correct target environment.
Remote login expects for the HTTP header remote-login to be included in all API requests to the server in a header that looks like the following:
remote-login: true
Endpoint
| Environment | Endpoint |
|---|---|
| Production | http://web-prod.qaifn.co.uk/login |
| UAT | http://public-ramtracking-uat-alb-394218217.eu-west-1.elb.amazonaws.com/login |
| Staging | http://public-ramtracking-staging-alb-720000886.eu-west-1.elb.amazonaws.com/login |
Errors
The Remote Login uses the following error codes:
| Error Code | Meaning |
|---|---|
| 400 | Bad Request -- Your request is invalid. |
| 403 | Forbidden -- The requested is hidden for administrators only. |
| 404 | Not Found -- The specified url could not be found. |
| 405 | Method Not Allowed -- You tried to access a user with an invalid method. |
| 406 | Not Acceptable -- You requested a format that isn't the specified type for that endpoint. |
| 418 | I'm a teapot. |
| 429 | Too Many Requests -- You're requesting too many kittens! Slow down! |
| 500 | Internal Server Error -- We had a problem with our server. Try again later. This can happen when spamming a single set of credentials. |
| 503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later. |