Logging in to InfoScale Operations Manager Web services API
InfoScale Operations Manager provides enhanced security by preventing Cross-Site Request Forgery (CSRF) attempts for web services APIs. This ensures that unauthorized users cannot perform malicious actions on behalf of authenticated users.
To safeguard API interactions, InfoScale Operations Manager uses CSRF tokens in conjunction with session IDs. When you establish a session a unique CSRF token is generated, which you are required to use when you log in. The CSRF token is stored in a cookies.txt file along with your session ID.
Note the following points:
-
File location: The cookies.txt file must be located in the same directory from which your API calls are executed.
-
Token expiry: For security, the CSRF token expires after 30 minutes of inactivity. When the token expires, the authenticated session times out.
-
Reauthentication: If the session times out, you must reestablish the session and log in again using the new CSRF token.
To execute APIs using CSRF tokens:
-
Establish a session and generate a CSRF token:
curl -g -k -c cookies.txt -D headers.txt <https://<hostname>>:14161/vom/ -
Log in using the CSRF token from the previous step (1):
curl -g -k -b cookies.txt -c cookies.txt -d user=<username> -d password=<password> -d domain=<domain-name> -d "csrfPreventionSalt=<token>" <https://<hostname>>:14161/vom/api/loginwhere token is the CSRF token that was stored in the cookies.txt file. -
Use the cookies.txt file to execute APIs:
curl -g -k -b cookies.txt "<https://<hostname>>:14161/vom/api/query/server/host"
More Information
Related information