Login User
Create a user session token, which can then be passed to other web services.
POST https://instance.securid.com/aveksa/command.submit?cmd=loginUser
💡 Tip: In order to get the login instructions or guidance on how to use the system, the getLoginInstructions command can be called. This returned information can then be shown to the end user prior to calling the loginUser command.
Request​
Parameters​
| getLoginInstructions | |
| format | properties - (Default) key=value. most useful when requesting a single object. If multiple objects are returned, values is a csv. ie key=value1,value2,value3 where value1 is the value for the first object, value2 is the value for the 2nd object, etc.json - Useful format for parsing into javascript or other languages. See www.json.org for details. |
Headers​
Bearer token | |
| Accept | application/json |
| Content-Type | application/json |
Body​
<username>{{UserName}}</username>
<password>{{Password}}</password>
<authsource>value</authsource>
UserName | The username used to log in. |
Password | The password used to log in. |
authsource | An optional auth source provider name used to log in with such as an ldap provider. This can included as an URL parameter alternatively. In the case of using a third party SSO please ensure an SSO Authenticator Provider is configured appropriately and then invoke the loginUser command with the right authsource. The auth source provider name used to log in such as SSO user header or SSO SAML can be provided as content in the POST or as a request parameter. A request parameter is recommended so the post can be used for anything like a SAML assertion. |
Response​
Parameters​
type | Executed command name |
token | The security token for this user |
Examples​
Request​
- Curl
- Python
- Node.js
curl --location --request POST \
"https://instance.securid.com/aveksa/command.submit?cmd=loginUser&format=json" \
-H "Content-Type: application/json" \
--data "<username>user01</username><password>password123</password>"
import requests, json
url = "https://instance.securid.com/aveksa/command.submit"
params = {
"cmd": "loginUser",
"format": "json"
}
username = "username_here"
password = "password_here"
payload = f"<username>{username}</username><password>{password}</password>"
headers = {
'Content-Type': 'application/xml'
}
response = requests.post(url, params=params, data=payload, headers=headers)
if response.status_code == 200:
data = response.json()
token = data.get("data", {}).get("token")
if token:
print(f"Token: {token}")
else:
print("Token not found in the response.")
else:
print(f"Request failed with status code {response.status_code}")
const axios = require('axios');
const url = "https://instance.securid.com/aveksa/command.submit";
const params = {
cmd: "loginUser",
format: "json"
};
const username = "username_here";
const password = "password_here";
const payload = `<username>${username}</username><password>${password}</password>`;
const headers = {
'Content-Type': 'application/xml'
};
axios.post(url, payload, { params, headers })
.then(response => {
if (response.status === 200) {
const responseData = response.data;
const token = responseData.data?.token;
if (token) {
console.log(`Token: ${token}`);
} else {
console.log("Token not found in the response.");
}
} else {
console.log(`Request failed with status code ${response.status}`);
}
})
.catch(error => {
console.error('Error:', error);
});
Response​
- 200
- 401
{
"data": {
"type": "loginUser",
"token": "ws31012566e36e3be2c9:-28aff589:18a2758240d:-7c4e0.5767652570173257"
}
}
<html>
<head>
<title>Error</title>
</head>
<body>User could not be validated. The username or password may be incorrect.
Query String=cmd=loginUser&format=json</body>
</html>