You must authenticate to the Qualys Cloud Platform using Qualys account credentials (username and password) and get the JSON Web Token (JWT) before you can start using the OCA APIs.
The Authentication API returns a JSON Web Token (JWT) which you can use for authentication during OCA API calls. The token expires in 4 hours. You must regenerate the token to continue using the OCA API.
HTTP Status Code
- 201: Created
- 401: Unauthorized user
- 404: Not Found
Input ParametersInput Parameters
Parameter |
Mandatory /Optional |
Data Type |
Description |
---|---|---|---|
username |
Mandatory | String |
The username of the Qualys user account for which you want to fetch OCA data. |
password |
Mandatory | String |
The password of the Qualys user account for which you want to fetch OCA data. |
token |
Mandatory | Boolean |
The value must be set to True, to get the generated token. |
ContentType |
Mandatory | Text |
It must be "application/x-www-form-urlencoded". |
gateway.qg1.apps.qualys.com |
Mandatory | URL |
The API gateway URL to the Qualys API server where your account is located. |
Request
curl -X POST 'https://<api_gateway_url>/auth' -d 'username=username&password=password&token=true' -H 'ContentType: application/x-www-form-urlencoded'
Response
kyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJxdWF5c19hdzM5IiwibG9naW5SZXNwb25zZSI6IlNVQ0NFU1NGVUwiLCJzdWNjZXNzZnVsQXV0aGVudGljYXRpb25IYW5kbGVycyI6WyJBdXRoSGFuZGxlcjJdLCJpc3MiOiJxYXMiLCJpcEFkZHJlc3MiOiIxMC4wLjIwMy4xODQiLCJwb3J0YWxVc2VySWQiOjIzODczNDU1NCwidXNlcnR5cGUiOiJmbyIsInF3ZWJVc2VySWQiOjM0NzkwMjYsImNyZWRlbnRpYWxUeXBlIjoiPRRzZXJuYW1lUGFzc3dvcmRDcmVkZW50aWFsIiwiYXVkIjoicWFzIiwibW9kdWxlc0FsbG93ZWQiOlsiQURNSV4iLCJBU1NFVCBJTlZFTlRPUlkiLCJDRVJUVklFVyItIkZSRUUgQUdFTlQiLCJQQyBTQ0FOTkVSIiwiUFMiLCJRR1MiLCJDQSIsIkNFUlRfVklFVyIsIktCWCIsIk9DQSIsIlBPUlRBTCBUQUdHSU5HIiwiVEhSRUFUIFBST1RF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