# Using Firebase\\JWT to generate JWT token

**URL:** <https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905>\
**Category:** API and Webhooks\
**Created:** [March 17, 2021, 7:34pm UTC](https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905 "2021-03-17T19:34:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![seminars](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@seminars](https://devforum.zoom.us/u/seminars)\
**Post date:** [March 17, 2021, 7:34pm UTC](https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905/1 "2021-03-17T19:34:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![seminars](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@seminars](https://devforum.zoom.us/u/seminars)\
**Post date:** [March 17, 2021, 7:38pm UTC](https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905/2 "2021-03-17T19:38:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [March 18, 2021, 1:33am UTC](https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905/3 "2021-03-18T01:33:43Z")

</div>

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:

> [@All I want to do is use the API to register an attendee. How?](https://devforum.zoom.us/t/all-i-want-to-do-is-use-the-api-to-register-an-attendee-how/45853/7):
>
> Hey @seminars, Thank you for your questions. Yes, this is something we plan to fix in the near future. In the meantime, you can use the other options or generate a JWT using tools like [JWT.io](http://JWT.io). First, please make sure that your server is using a UTC timezone. If that doesn’t help, please send an email to [developersupport@zoom.us](mailto:developersupport@zoom.us) with a link to this thread. In that email, please include an example of a JWT token that has failed in the past. I’ll investigate the issue further using that infor…

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [April 17, 2021, 11:34am UTC](https://devforum.zoom.us/t/using-firebase-jwt-to-generate-jwt-token/45905/4 "2021-04-17T11:34:15Z")

</div>

Closed on April 17, 2021, 11:34am UTC

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