# "Invalid Token!" error message when trying to refresh oauth token

**URL:** <https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363>\
**Category:** API and Webhooks\
**Created:** [April 15, 2020, 5:58pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363 "2020-04-15T17:58:14Z")\
**Posts on this page:** 20\
**Page:** 5

<div class="post-metadata">

**Author:** ![viddd](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/viddd/32/8456_2.png) [@viddd](https://devforum.zoom.us/u/viddd)\
**Post date:** [October 10, 2020, 10:54am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/85 "2020-10-10T10:54:28Z")

</div>

Hope this helps others: different environments will invalidate the others’ refresh tokens. For example,

1. user on dev server does oAuth workflow.
2. user on staging server does oAuth with same account
3. dev server user tries to use access token. it fails, so it tries refresh. Invalid token error.
4. dev server now broken because staging server got the most recent access & refresh tokens.
5. dev server re-authorizes. refreshes work, but now staging server is broken.  
…the cycle continues.

Take heart knowing on production this won’t happen because your users won’t be running oAuth transactions on your dev servers.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [October 12, 2020, 6:45pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/86 "2020-10-12T18:45:39Z")

</div>

Thanks for sharing your experience with our community @viddd 🙂

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 14, 2020, 6:11pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/87 "2020-11-14T18:11:51Z")

</div>

Hi @will.zoom and @tommy - I had this problem due to using the same zoom account to test using two different of my own system’s user accounts. I.e. when user 2 linked the same zoom account as user 1, user 1 would still appear linked but the tokens would not work due to the problem described above. I wonder, is there any way to identify that two sets of auth tokens come from the same zoom account, so that I can “unlink” the first user when a second links the same zoom account, without requesting access to the “user” scope? At the moment I am just asking for the ability to create meetings, and would rather keep it that way rather than risk scaring users with demands for access to their full zoom profile.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 16, 2020, 10:11pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/88 "2020-11-16T22:11:08Z")

</div>

Hey @budgetcriticism,

Good question. One option could be to grab the access token when a user installs the app. You can JWT decode this to determine which user/account it belongs to. You can see my post here for more details on this approach (different topic, but decoding the access token is still relevant):

> [@Deauthorization endpoint user identification](https://devforum.zoom.us/t/deauthorization-endpoint-user-identification/33047/6):
>
> Hey @dave2 , Thank you for clarifying, and my sincere apologies for not catching your concern from the onset. I understand now that you’re essentially looking to make this connection with a customer’s Account ID as soon as they authorize/install the app, so that you can then have this record on your end when they uninstall (but please correct me if I’m misunderstanding). While there’s not a completely straight forward way to track this, there is a suggestion I can make: When an account author…

Let me know if this helps,  
Will

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 16, 2020, 10:29pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/89 "2020-11-16T22:29:27Z")

</div>

Hi @will.zoom. Thank you very much for your reply. I’d actually already seen a post about jwt-decoding the auth token, and extracting the user ID, but I wasn’t sure which claim / key in the JWT to use. I have since decided it must be the “uid” given that I can see the same string used to represent me elsewhere in the zoom system, but seeing as it’s not documented anywhere I am not sure - also I noticed today @tommy in a different post explaining that seeing as this is an unofficial API it can unexpectedly change. So, I’ll need to think about how to handle that! I’ll probably just have to set-up monitoring to catch a change to the data in the token and respond appropriately and / or respond to failing API requests by retrying once and then un-linking the user’s account and sending an apologetic email (or something). Unless you can correct me about the API being unstable? It would be great, one-day, if you could put that data in the token on an official basis, so we could rely on it properly.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 17, 2020, 9:08pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/90 "2020-11-17T21:08:40Z")

</div>

Hey @budgetcriticism,

Thank you for the feedback, and happy to clarify. Just to make sure we’re on the same page, when you talk about an API that could change in the future, are you referring to the method of decoding a JWT token or a specific endpoint? Our OAuth endpoint should be pretty stable.

Let me know!  
Will

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 17, 2020, 9:39pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/91 "2020-11-17T21:39:00Z")

</div>

Hi @will.zoom - sorry for using unclear language. I’m referring to the method of using jwt-decode to extract the user ID from the oauth access token.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 18, 2020, 9:12pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/92 "2020-11-18T21:12:50Z")

</div>

Hi @budgetcriticism,

Thanks for clarifying—we don’t have any plans to change how OAuth access tokens are encoded. That said, this is a workaround of sorts, and can appreciate the desire to have a more efficient way of handling this. I’m happy to share this feedback internally.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 18, 2020, 10:21pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/93 "2020-11-18T22:21:40Z")

</div>

Thanks, @will.zoom . It would just be useful to know this is reliable in the long-term. But, also good to know you don’t plan to change it.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 19, 2020, 6:16pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/94 "2020-11-19T18:16:26Z")

</div>

Hi @budgetcriticism,

You can keep an eye on our [Changelog](https://marketplace.zoom.us/docs/changelog) to keep track of any changes to Zoom APIs, but correct—no plans to change this.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 19, 2020, 7:24pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/95 "2020-11-19T19:24:06Z")

</div>

Brilliant, thank you for that. I have subscribed (and noticed the RSS feeds, of which I approve). Would you be able to confirm please that the “uid” key is the one I need to detect that two oauth tokens were generated using the same zoom login?

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 20, 2020, 9:52pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/96 "2020-11-20T21:52:08Z")

</div>

Hey @budgetcriticism,

The UID refers to the User ID of the User who installed the app, and the AUD refers to the account of the user who installed the app. Does this help?

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![budgetcriticism](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@budgetcriticism](https://devforum.zoom.us/u/budgetcriticism)\
**Post date:** [November 20, 2020, 10:05pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/97 "2020-11-20T22:05:19Z")

</div>

Yes, that’s helpful. Thank you.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 23, 2020, 4:38pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/98 "2020-11-23T16:38:29Z")

</div>

No problem, glad I could help @budgetcriticism!

Best,  
Will

---

<div class="post-metadata">

**Author:** ![nilkanth](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/nilkanth/32/20772_2.png) [@nilkanth](https://devforum.zoom.us/u/nilkanth)\
**Post date:** [January 5, 2021, 9:49am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/99 "2021-01-05T09:49:24Z")

</div>

Hey @will.zoom,  
I have the same issue with refreshing token API  
when I am using the **POST** method it gives me an **invalid token error** and when I am using the **GET** method so it should give the below response can you tell me is the right response or not if not so where is my mistake …

> object(GuzzleHttp\Psr7\Stream)#39 (7) { [“stream”:“GuzzleHttp\Psr7\Stream”:private]=\> resource(62) of type (stream) [“size”:“GuzzleHttp\Psr7\Stream”:private]=\> NULL [“seekable”:“GuzzleHttp\Psr7\Stream”:private]=\> bool(true) [“readable”:“GuzzleHttp\Psr7\Stream”:private]=\> bool(true) [“writable”:“GuzzleHttp\Psr7\Stream”:private]=\> bool(true) [“uri”:“GuzzleHttp\Psr7\Stream”:private]=\> string(10) “php://temp” [“customMetadata”:“GuzzleHttp\Psr7\Stream”:private]=\> array(0) { } }

---

<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:** [January 5, 2021, 10:12pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/100 "2021-01-05T22:12:08Z")

</div>

Hey @nilkanth,

Thank you for reaching out to the Zoom Developer Forum. Please create a separate forum post for this issue including the request body, endpoint and response so that we can focus on all the information there. We’ll be sure to assist you ASAP in that new post.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![ryanyewtf](https://avatars.discourse-cdn.com/v4/letter/r/ba9def/32.png) [@ryanyewtf](https://devforum.zoom.us/u/ryanyewtf)\
**Post date:** [April 27, 2021, 2:59pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/101 "2021-04-27T14:59:50Z")

</div>

Did anyone get this problem resolved? I’m experiencing the same issue, where I store the tokens into the db after authorization, then create meetings by retrieving token from the db, hours later, the token expired, so I use refresh\_token to refresh the token, but it returns 401 invalid token all the time and here’s the error

 ![Screen Shot 2021-04-27 at 7.58.00 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/3/4/34f6109dba77212d7ffdee63bdf70ad81f74672c.png)

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [April 28, 2021, 3:54pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/102 "2021-04-28T15:54:25Z")

</div>

Hi @ryanyewtf,

This sounds like it could be an issue with the refresh token you’re using. Can you ensure you’re using the refresh token that was returned when you originally retrieved your access\_token? Note that the purpose of a refresh token is to retrieve a new access\_token and refresh\_token pair at the same time. You can read more about this flow [here](https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing) as well.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![fahad.beehive](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/fahad.beehive/32/17024_2.png) [@fahad.beehive](https://devforum.zoom.us/u/fahad.beehive)\
**Post date:** [June 7, 2021, 10:09pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/103 "2021-06-07T22:09:44Z")

</div>

Not trying to spam the forums, but since no one’s pointed this out in the threads above: there is an internal limit within Zoom: it does not support accounts authenticated on more than 1 device at a time. If you authenticate on another machine with the same account, the previous tokens invalidate. This has been discussed here:

> [@Frequently receiving invalid\_request / token revocation from Zoom](https://devforum.zoom.us/t/frequently-receiving-invalid-request-token-revocation-from-zoom/44220/23):
>
> We appreciate the feedback, Fahad. We will continue to keep you posted on new developments. Best, Will

If you connect your Zoom account to two or more 3rd party apps, you’ll experience the same issue, i.e., your token will invalidate after around 24 hours. There’s absolutely no way around this at the moment. When this happens, your refresh token is invalidated too and you cannot perform a refresh until you re-authenticate.

The user will see a prompt to authorize your app after around 24 hours since they last logged into some other app. This is a serious flaw in Zoom’s authentication mechanism. I’ve seen dozens of reports since last year, differently worded but with the same symptoms.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [June 8, 2021, 9:43pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/104 "2021-06-08T21:43:16Z")

</div>

Thanks for sharing your experience on this thread, Fahad.

[Previous page](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363.md?page=4)

[Next page](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363.md?page=6)
