I am trying to authenticate to the sophos intellix authenticate api:
curl --location --request POST 'api.labs.sophos.com/.../token' --header 'Content-Type: application/json;charset=UTF-8' --header 'Authorization: Basic {encoded key:secret}' --data-raw 'grant_type=client_credentials
I am receiving this response:
400 ERROR The request could not be satisfied.
Bad request. We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
Generated by cloudfront (CloudFront) Request ID: cbA_F5avox5aIXvXdc91LFbn0PylJY4LfKqB_bYL7dfMsgCFElTArA==
What am I missing in the cURL request?
To clarify,
https://api.labs.sophos.com/doc/authentication.html
$ curl \ -X POST \ -H 'Authorization: Basic [YOUR INFO HERE]' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -i …
$ curl \ -X POST \ -H 'Authorization: Basic [YOUR INFO HERE]' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -i api.labs.sophos.com/.../token \ -d 'grant_type=client_credentials' HTTP/2 200 content-type: application/json;charset=UTF-8
YOUR INFO HERE = Basic: Base64Encode(client_id:client_secret).
Which is like this:
$ curl \ -X POST \ -H 'Authorization: Basic MXJxbmR1[...]ms3OXNyMjAyamE2YTVraWZnNWd0ZTlx' \ -H 'Content-Type: application/x-www-form-urlencoded' \ -i api.labs.sophos.com/.../token \ -d 'grant_type=client_credentials' HTTP/2 200 content-type: application/json;charset=UTF-8
RichardP
Program Manager, Support Readiness | CISSP | Sophos Technical SupportSupport Videos | Product Documentation | @SophosSupport | Sign up for SMS AlertsIf a post solves your question use the 'Verify Answer' link.
Oh gosh... had the wrong content type header value Zong internet packages
--header 'Content-Type: application/x-www-form-urlencoded'
The full curl request:
curl --location -X POST 'api.labs.sophos.com/.../token' --header 'Content-Type: application/x-www-form-urlencoded' --header 'Authorization: Basic {encoded key:secret}' --data-raw 'grant_type=client_credentials' -i
Glad to be of help.