Need help in generating access token for Checkmarx API

3.4k Views Asked by At

I would be working on a POC to get checkmarx reports using REST API, for this I have reffered checkmarx API knowledge documentation and it looks like we need an access token to interact with checkmarx API using Java REST API.

Can someone please help me on how to generate Access token for Checkmarx API.

Thanks, Karthik P.

1

There are 1 best solutions below

0
On

This is described in the documentation

Basically, you need to send POST request to /cxrestapi/auth/identity/connect/token endpoint with bunch of hardcoded values:

'grant_type': 'password',
'scope': 'sast_rest_api',
'client_id': 'resource_owner_client',
'client_secret': '014DF517-39D1-4453-B7B3-9930C563627C',

And your credentials:

'username': 'INSERT_USERNAME',
'password': 'INSERT_PASS',

If everything is OK, you'll get JSON response with access_token key which is your token, to be used in following requests as header like Authorization: Bearer <INSERT_TOKEN>