# previously working webinar registration code now returning 401

**URL:** <https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490>\
**Category:** API and Webhooks\
**Created:** [July 24, 2018, 3:22pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490 "2018-07-24T15:22:22Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 24, 2018, 3:22pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/1 "2018-07-24T15:22:22Z")

</div>

I’ve created a webinar registration system on our website to handle payments, and I use the API to then send those registration details to Zoom. It’s worked flawlessly in the past, but when I put up registration for our latest webinar last week, I started getting 401 unauthorized responses. Nothing in the code or environment has changed, with the exception of the typical Windows updates on the server.

I’m using the Firebase library to generate the JWT token, I’ve verified that the API key and secret are correct, and I’ve even regenerated the secret, all to no avail. I’m using PHP 5.6.31 on IIS 7.5 (Server 2008R2).

I contacted support, but this is (understandably) a little beyond what they can solve, other than telling me that my account looks fine.

My code actually looks pretty similar to what’s in the API documentation, with the exception of using stream\_context\_create and file\_get\_contents to get the response. The endpoint I’m targeting is /v2/webinars/{webinarId}/registrants.

At this point I’m kind of at a loss.

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [July 24, 2018, 4:59pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/2 "2018-07-24T16:59:46Z")

</div>

Hi Nan,&nbsp;

Can you make sure the Firebase library is generating an integer for the exp value? Also, can you post the request payload that you are using to call the API?

Thanks

---

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 24, 2018, 6:15pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/3 "2018-07-24T18:15:14Z")

</div>

The exp value is being set as time() + 60, so it is generating as an integer, which I’ve verified by checking the token in the debugger on [jwt.io](http://jwt.io). The request is a json\_encode of an array with all the necessary info: $userInfo = array(‘email’=\>$email, ‘first\_name’=\>$firstName, ‘last\_name’=\>$lastName, ‘city’=\>$city, ‘state’=\>$state, ‘zip’=\>$zipcode, ‘country’=\>$country, ‘job\_title’=\>$jobtitle);

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [July 24, 2018, 7:22pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/4 "2018-07-24T19:22:40Z")

</div>

Hi Nan,&nbsp;

What is the webinar ID and what action (GET, POST, PUT) are you using for the endpoint/v2/webinars/{webinarId}/registrants?

---

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 24, 2018, 7:27pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/5 "2018-07-24T19:27:47Z")

</div>

In this case, the webinar ID is 748263740, and I’m using a POST action.

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [July 24, 2018, 8:00pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/6 "2018-07-24T20:00:07Z")

</div>

Hi Nan,&nbsp;

Have you tried running the same API through our&nbsp;[playground site](https://developer.zoom.us/playground/#/Webinars/webinarRegistrantCreate)&nbsp;or with postman to see if you’re able to add registrants?

Thanks

---

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 24, 2018, 8:16pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/7 "2018-07-24T20:16:06Z")

</div>

Through the playground site, it appears to work just fine. I put the webinar ID in and the output of json\_encode on my registrant array, and the registrant did show up in the registrant list.

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [July 24, 2018, 8:44pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/8 "2018-07-24T20:44:51Z")

</div>

Hi Nan,&nbsp;

Ok since it’s working with the playground. Let’s see if it has something to do with the Firebase library token as other users had issues with that before.&nbsp;&nbsp;

1. Can you generate your jwt token using the firebase library?
2. Afterwards, use Postman to make the same call you did within playground but using the token generated by Firebase.

If you are able to make the a successful call then it might be something with the php codebase, if not then we might need to investigate further how the firebase is generating the token.&nbsp;

Thanks

---

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 25, 2018, 2:07pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/9 "2018-07-25T14:07:58Z")

</div>

Ok, so I used my code to generate a longer lasting token (in production it’s 60 seconds), and I can successfully add a webinar registrant using postman.

---

<div class="post-metadata">

**Author:** ![Nan\_Freund](https://avatars.discourse-cdn.com/v4/letter/n/c5a1d2/32.png) [@Nan\_Freund](https://devforum.zoom.us/u/Nan_Freund)\
**Post date:** [July 25, 2018, 3:50pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/10 "2018-07-25T15:50:01Z")

</div>

I think I figured it out. Just on a whim, I set the token expiration to be time() + 120 instead of time() + 60. Suddenly registration worked as expected. When I looked at the time on my webserver, it was almost 2 minutes behind, so for some reason it wasn’t correctly synchronizing the time. My guess is that it was more than a minute behind the time on the zoom server, so even though I was using the token immediately, from the zoom server perspective, it had already expired.

Thanks for all your help, though! I didn’t know about the playground or Postman before this!

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [July 25, 2018, 4:05pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/11 "2018-07-25T16:05:10Z")

</div>

Hi Nan,&nbsp;

I’m glad that you were able to figure it out and find out about playground/postman.

Thanks

---

<div class="post-metadata">

**Author:** ![i\_Alam](https://avatars.discourse-cdn.com/v4/letter/i/ba9def/32.png) [@i\_Alam](https://devforum.zoom.us/u/i_Alam)\
**Post date:** [July 28, 2018, 5:18pm UTC](https://devforum.zoom.us/t/previously-working-webinar-registration-code-now-returning-401/1490/12 "2018-07-28T17:18:33Z")

</div>

Thank you Micheal, for given perfect answer,&nbsp;Its really easy to understand language you have used here. It has fixed my correlated issue.

Thanks,

Alam  
[Freelancer](https://www.mjobrr.com)
