Using Firebase\JWT to generate JWT token

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??

BTW… I can use a test JWT token from Zoom’s App Marketplace as the value for $jwt and it works fine (registers the new user). Just wanted to clarify the cURL script to register a new attendee functions as it should… it’s just the JWT token generation that’s baffling me.

Hey @seminars,

Thank you for making a new topic for this issue. I would respond here but I already responded to this question in your older post:

Thanks,
Max

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.