0

I am trying to get all events from CVENT via REST API. As I understand, at first I need to authorise.

    $curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL => "https://api-platform.cvent.com/ea/oauth2/token",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYHOST =>false,
    CURLOPT_SSL_VERIFYPEER => false,
    CURLOPT_ENCODING => "",
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 30,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => "POST",
    CURLOPT_POSTFIELDS => "grant_type=client_credentials&client_id=clietID",
    CURLOPT_HTTPHEADER => array(
        'Authorization: Basic ' . base64_encode("clietID:clietSECREAT"),
        'Content-Type: application/x-www-form-urlencoded',
    ),
));

// EXECUTE:
$result = curl_exec($curl);
if(!$result){die("Connection Failure");}
curl_close($curl);

var_dump($result);

I always get "Request failed authentication/authorization process". clietID and clietID:clietSECREAT are changed and right.

What am I doing wrong in this first step?

The documentation is here: https://developer-portal-eur.cvent.com/documentation#section/Getting-Started/Authentication

  • The `grant_type` and `client_id` aren’t headers and should instead be sent as [part of the body](https://stackoverflow.com/a/871445/231316) – Chris Haas May 30 '22 at 13:37
  • It didn't help me. – thomas.jungersen May 30 '22 at 13:48
  • Please post your updated code with those parameters placed in the body and removed from the header. – Chris Haas May 30 '22 at 14:39
  • Thank you. If you are certain that your credentials are correct, my next recommendation would be to try the manual command line curl version. If it doesn't work there, either, I'd contact the company. Its possible that your credentials aren't approved for the `{hostName}` or something else on their end. – Chris Haas May 30 '22 at 15:34

0 Answers0