# Code change , why?

**URL:** <https://devforum.zoom.us/t/code-change-why/24909>\
**Category:** API and Webhooks\
**Created:** [July 22, 2020, 6:25pm UTC](https://devforum.zoom.us/t/code-change-why/24909 "2020-07-22T18:25:03Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![a.sinnige](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@a.sinnige](https://devforum.zoom.us/u/a.sinnige)\
**Post date:** [July 22, 2020, 6:25pm UTC](https://devforum.zoom.us/t/code-change-why/24909/1 "2020-07-22T18:25:03Z")

</div>

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
Oauth (+JWT)

I’ve been running a video editor for my users for the last 3 months or so. Was code complete. Somewhere last week something changed that broke my site/app.

This is the code I was running in PHP :

> function get\_access\_token\_and\_user\_id($oauth\_token,$website\_redirect,$Client\_id,$Client\_secret,&$user\_id,&$access\_token){  
> $url = ‘[https://zoom.us/oauth/token?grant\_type=authorization\_code&code=](https://zoom.us/oauth/token?grant_type=authorization_code&code=)’ . $oauth\_token . ‘&redirect\_uri=’ . $website\_redirect;  
> $options = array(  
> ‘http’ =\> array(  
> ‘header’ =\> "Authorization: Basic " . base64\_encode($Client\_id . “:” . $Client\_secret),  
> ‘method’ =\> ‘POST’  
> )  
> );  
> $context = stream\_context\_create($options);  
> $result = file\_get\_contents($url, false, $context);  
> if ($result === FALSE) {  
> return false;  
> }  
> $data = json\_decode($result);  
> $access\_token = $data-\>access\_token;  
> $str\_exploded = explode(‘.’,$access\_token);  
> $final = json\_decode(base64\_decode($str\_exploded[1]));  
> $user\_id = $final-\>uid; **// NOW THIS IS CORRECT**  
> // $user\_id = $final-\>userId; **// THIS USED TO BE CORRECT**  
> return true;  
> }

Why did you guys change this ? Seems an unrequired change that only breaks code without actually adding anything…

This is what $final now looks like :

> object(stdClass)#2 (14) {  
> [“ver”]=\> int(7)  
> [“auid”]=\> string(32) “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”  
> [“code”]=\> string(33) “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx”  
> [“iss”]=\> string(29) “zm:cid:xxxxxxxxxxxxxxxxxxxx”  
> [“gno”]=\> int(0)  
> [“type”]=\> int(0)  
> [“tid”]=\> int(0)  
> [“aud”]=\> string(21) “[https://oauth.zoom.us](https://oauth.zoom.us)”  
> **[“uid”]=\> string(22) “xxxxxxxxxxxxxxxxxxxxxxxx”**  
> [“nbf”]=\> int(1595440646)  
> [“exp”]=\> int(1595444246)  
> [“iat”]=\> int(1595440646)  
> [“aid”]=\> string(22) “xxxxxxxxxxxxxxxxxxxxxx”  
> [“jti”]=\> string(36) “xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx” }

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 27, 2020, 5:43pm UTC](https://devforum.zoom.us/t/code-change-why/24909/3 "2020-07-27T17:43:01Z")

</div>

Hey @a.sinnige,

Not sure what you are trying to do. Are you trying to JWT Decode the access token? If so, doing so is not documented or supported, hence, could change anytime.

To get the userID of a user, use the [Get User API](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/user).

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![a.sinnige](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@a.sinnige](https://devforum.zoom.us/u/a.sinnige)\
**Post date:** [July 27, 2020, 7:12pm UTC](https://devforum.zoom.us/t/code-change-why/24909/4 "2020-07-27T19:12:07Z")

</div>

I was using your own advice 🙂

> [@Need user ID along with zoom code](https://devforum.zoom.us/t/need-user-id-along-with-zoom-code/6320/6):
>
> Hey @sivanesan.murugesan I see! You can use the userId in the JWT decoded object to make a request to [GET /users/{userId}](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/user) which has the email in the response. Thanks, Tommy

No worries about it.. I like keeping the amount of calls as few as possible.  
Why make more calls if you already have the information ?

It just seems like a change that to me served no purpose..

---

<div class="post-metadata">

**Author:** ![james2](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@james2](https://devforum.zoom.us/u/james2)\
**Post date:** [July 29, 2020, 4:19am UTC](https://devforum.zoom.us/t/code-change-why/24909/5 "2020-07-29T04:19:53Z")

</div>

This has broken my integration also. I’m surprised it’s been 6 days and only one other person is complaining.

Tommy, this is a breaking change, of normal behaviour.

Example behaviour:

- User signs up for app on marketplace
- User accepts permissions
- User is redirected to 3rd party website with a “code” URL param
- 3rd party website makes a call to [https://zoom.us/oauth/token](https://zoom.us/oauth/token) to confirm the “code”
- Zoom responds with accessToken and refreshToken JWTs
- 3rd party stores the JWTs for later use. The accessToken JWT includes “userId” which is equivalent to the “host\_id” returned by many Zoom API calls. “userId” is stored as an individual database field for easy lookup

And then: Zoom cloud recording webhook:

- 3rd party app receives a webhook call from Zoom
- Webhook receiver code receives a JSON payload which includes payload.object.host\_id
- Search database for user with host\_id == payload.object.host\_id
- Download the cloud recording and connect it to that user

None of this can happen anymore, because the accessToken no longer contains a field “userId”. It has been renamed to “uid”.  
I now have to put yet another workaround in my Zoom code: check for tokenDecoded.uid || tokenDecoded.userId

---

<div class="post-metadata">

**Author:** ![Emanuel\_Aguirre](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@Emanuel\_Aguirre](https://devforum.zoom.us/u/Emanuel_Aguirre)\
**Post date:** [July 29, 2020, 6:03pm UTC](https://devforum.zoom.us/t/code-change-why/24909/6 "2020-07-29T18:03:19Z")

</div>

Get used to these changes from Zoom, they do it frequently without previous alerts to developers.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [July 29, 2020, 9:24pm UTC](https://devforum.zoom.us/t/code-change-why/24909/7 "2020-07-29T21:24:29Z")

</div>

Hey @Emanuel_Aguirre, @a.sinnige, @james2,

JWT Decoding the access token is not something listed on our docs, hence it could change anytime.

Apologies for the inconvenience and for suggesting this in the past.

To get the userID of a user, use the [Get User API](https://marketplace.zoom.us/docs/api-reference/zoom-api/users/user). The [me context](https://marketplace.zoom.us/docs/guides/auth/oauth#using-access-token) is also helpful when getting information about the user of the access token.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![james2](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@james2](https://devforum.zoom.us/u/james2)\
**Post date:** [July 31, 2020, 6:56am UTC](https://devforum.zoom.us/t/code-change-why/24909/8 "2020-07-31T06:56:14Z")

</div>

Hi Tommy,

I still respectfully disagree. It’s common practice to decode JWTs at either end and make use of that data. Any time an API changes an attribute name it is a breaking change.

Just because it’s “not listed in your docs” doesn’t mean that you can break common convention relating to it. I run a web app and none of my docs say “you can use a mouse to interact with this web app”, but I’m still not going to break mouse functionality one day for no reason.

---

<div class="post-metadata">

**Author:** ![james2](https://avatars.discourse-cdn.com/v4/letter/j/6a8cbe/32.png) [@james2](https://devforum.zoom.us/u/james2)\
**Post date:** [July 31, 2020, 6:57am UTC](https://devforum.zoom.us/t/code-change-why/24909/9 "2020-07-31T06:57:03Z")

</div>

Yep Emanuel, this is either the 4th or 5th breaking change I’ve had to deal with in the last couple of years of using Zoom APIs in production sites ☹

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 4, 2020, 5:32am UTC](https://devforum.zoom.us/t/code-change-why/24909/10 "2020-08-04T05:32:42Z")

</div>

Thanks for your feedback @james2.

-Tommy

---

<div class="post-metadata">

**Author:** ![capcutmodapk1](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/capcutmodapk1/32/47733_2.png) [@capcutmodapk1](https://devforum.zoom.us/u/capcutmodapk1)\
**Post date:** [April 19, 2023, 10:27am UTC](https://devforum.zoom.us/t/code-change-why/24909/11 "2023-04-19T10:27:18Z")

</div>

Thank you so much everyone for your helping content[.](https://capcutmodapk.info/) It really helped me in solving my problem. Keep sharing such valuable content.
