# Getting 401 trying to refresh authorization token

**URL:** <https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255>\
**Category:** API and Webhooks\
**Created:** [April 21, 2020, 3:32pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255 "2020-04-21T15:32:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kkoellner](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kkoellner/32/11928_2.png) [@kkoellner](https://devforum.zoom.us/u/kkoellner)\
**Post date:** [April 21, 2020, 3:32pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/1 "2020-04-21T15:32:25Z")

</div>

**Description**  
We have an oauth app that appears to be working most of the time. It will use a stored refresh token to get a new access token, then create a meeting using the access token for authorization. And of course it save the new refresh and access token for next time.

It seems to work most of the time but we’re occasionally getting a 401.

**Error**  
HTTP 401 unauthorized status code returned.

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

**Which Endpoint/s?**  
'[https://zoom.us/oauth/token](https://zoom.us/oauth/token)

**How To Reproduce (If applicable)**  
Post to URL [https://zoom.us/oauth/token](https://zoom.us/oauth/token)  
Content-Type-- ‘application/x-www-form-urlencoded  
_below is pseudo code for auth and body_  
Authorization-- "Basic " + base64 encoded (API Key + “:” + API Secret )  
body – grant\_type=refresh\_token’  
+ ‘&refresh\_token=’ + URLEncodedUTF-8(refreshtoken)

**Screenshots (If applicable)**  
N/A

**Additional context**  
Is there something that could make a stored refresh token no longer valid? It seems like it works most of the time but some users have reported occasional failure. If they manually reauthorize, it starts working for a while but could fail a few days later. But also, some users that haven’t authorized in weeks are code can refresh and get new tokens with no issues.

---

<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:** [April 22, 2020, 5:53pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/2 "2020-04-22T17:53:00Z")

</div>

Hey @kkoellner,

Are you sending the grant\_type and refresh token in the body?

Can you try adding it as query params as noted here:

[https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing](https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![kkoellner](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kkoellner/32/11928_2.png) [@kkoellner](https://devforum.zoom.us/u/kkoellner)\
**Post date:** [April 22, 2020, 6:06pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/3 "2020-04-22T18:06:49Z")

</div>

I may have found the issue. We’re getting an occasional {“code”:300,“message”:“Invalid meetingId”} on cancel meeting. Our code composes and exception for our application to handle at a higher level but then the token that was just refreshed doesn’t get saved. Bottom line is we have to put the save token in a “finally” so it always gets saved.

Note sure why we’re getting an occasional 300 on cancel, maybe the meeting was manually deleted outside our application.

---

<div class="post-metadata">

**Author:** ![kkoellner](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kkoellner/32/11928_2.png) [@kkoellner](https://devforum.zoom.us/u/kkoellner)\
**Post date:** [April 22, 2020, 6:10pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/4 "2020-04-22T18:10:06Z")

</div>

This is what we are getting on the cancel –

```
HttpRequest -- DELETE https://api.zoom.us/v2/meetings/null Content-Type:application/json Authorization:Bearer eyJhbGciOiJIUzUxMiIsInYiOiIyLjAiLzeCJraWQiOiI0MzY0OTE1OC1kYzQ3LTRjYzItOGJmYS1hMzk2YTUzODhhY2UifQ.eyJ2ZXIiOiI2IiwiY2xpZW50SWQiOiJTck1pMUJES1FtV19VSVZtTlJnR2hRIiwiY29kZSI6InozNHJYbTlWV3RfajluNXZXemZSd2VQSnd0VGlaNFFEZyIsImlzcyI6InVybjp6b29tOmNvbm5lY3Q6Y2xpZW50aWQ6U3JNaTFCREtRbVdfVUlWbU5SZ0doUSIsImF1dGhlbnRpY2F0aW9uSWQiOiIwZTVhOWI4MGUyMDk5MzhlYzNjYTU0MjZjOTFiMzI4MSIsInVzZXJJZCI6Imo5bjV2V3pmUndlUEp3dFRpWjRRRGciLCJncm91cE51bWJlciI6MCwiYXVkIjoiaHR0cHM6Ly9vYXV0aC56b29tLnVzIiwiYWNjb3VudElkIjoiSXpJMTJzN0dSVVNvc29UMk42WldYZyIsIm5iZiI6MTU4NzU3MzIzMiwiZXhwIjoxNTg3NTc2ODMyLCJ0b2tlblR5cGUiOiJhY2Nlc3NfdG9rZW4iLCJpYXQiOjE1ODc1NzMyMzIsImp0aSI6ImQxY2QzZTViLWIzZjAtNDA0Yy1hNTYzLTAyMDllNzRlN2E5MiIsInRvbGVyYW5jZUlkIjoxOX0.Wn0OOjFqXGlgTZoyT6mtPPBeVJs5JPDxeJdfUFs0se0oCTRAkFGRFifqUpQu-85CJ4_wbCtMITC5mb3AqNVSMg

```

HttpResponse – 400 null Transfer-Encoding:chunked Cache-Control:no-cache, no-store, must-revalidate, no-transform Server:ZOOM X-Content-Type-Options:nosniff Connection:keep-alive Set-Cookie:\_zm\_date\_format=mm/dd/yy; [Domain=.zoom.us](http://Domain=.zoom.us); Path=/; Secure;\_zm\_chtaid=""; [Domain=.zoom.us](http://Domain=.zoom.us); Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly;\_zm\_ctaid=""; [Domain=.zoom.us](http://Domain=.zoom.us); Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly;zm\_haid=""; [Domain=.zoom.us](http://Domain=.zoom.us); Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly;zm\_aid=""; [Domain=.zoom.us](http://Domain=.zoom.us); Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/; Secure; HttpOnly Expires:Thu, 01 Jan 1970 00:00:00 GMT Pragma:no-cache x-zm-trackingid:WEB\_fb30f595b872200daef40c4bf4244589 Date:Wed, 22 Apr 2020 16:33:52 GMT Content-Type:application/json;charset=UTF-8  
{“code”:300,“message”:“Invalid meetingId”}

---

<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:** [April 23, 2020, 5:05pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/5 "2020-04-23T17:05:10Z")

</div>

Hey @kkoellner,

Yeah you cannot pass in `null` as the meeting ID. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 8:54pm UTC](https://devforum.zoom.us/t/getting-401-trying-to-refresh-authorization-token/14255/6 "2020-08-21T20:54:30Z")

</div>

Closed on August 21, 2020, 8:54pm UTC


