I’m using Firebase\JWT to generate a token… I then copy the token my script generates (using Firebase) and paste it into the debugger at https://jwt.io and it shows a nice blue “Signature Verified” with a checkmark. It’s also showing the correct “iss” value which is my API secret.
However, my cURL script to register an attendee using this generated token produces an error of:
{“code”:124,“message”:“Invalid access token.”}
This is my code…
use Firebase\JWT\JWT;
$key = "myAPIkey";
$payload = array(
"iss" => "myAPIsecret",
"exp" => time()+3600, // expire in 1 hours
);
$jwt = JWT::encode($payload, $key, 'HS256');
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.zoom.us/v2/webinars/{WEBINARid}/registrants",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"email\":\"test@test.com\",\"first_name\":\"TestFN\",\"last_name\":\"TestLN\"}",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer ".$jwt,
"content-type: application/json"
),
));
What am I doing wrong here??