# "Invalid Token!" when trying to Refresh Token to get a new access\_token, refresh\_token pair

**URL:** <https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813>\
**Category:** API and Webhooks\
**Created:** [January 28, 2021, 1:17pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813 "2021-01-28T13:17:35Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![chrismurrph](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chrismurrph/32/21804_2.png) [@chrismurrph](https://devforum.zoom.us/u/chrismurrph)\
**Post date:** [January 28, 2021, 1:17pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/1 "2021-01-28T13:17:36Z")

</div>

**Description**  
The access-token expires every hour so I need to use the refresh\_token to get a new access\_token, refresh\_token pair. However I may not be using the latest refresh\_token. But how can I know what the latest is? It may have been discarded. Seems like an unrecoverable position to be in! Any way to find out what the latest access-token and refresh\_token is? Or even that in fact the refresh\_token I’m using is not the latest.

**Error**  
status 401  
body {“reason”:“Invalid Token!”,“error”:“invalid\_request”}

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

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

**Additional context**  
The App Name is actually “Audience Republic Dev”. Just private developing and at the moment we just use one login: [arep\_engineering@audiencerepublic.com](mailto:arep_engineering@audiencerepublic.com)

---

<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 29, 2021, 2:17am UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/2 "2021-01-29T02:17:17Z")

</div>

Hey @chrismurrph,

Thank you for reaching out to the Zoom Developer Forum. Great question! When attempting to authorize with a `refresh_token` you can check for a 401 response. If you encounter a 401 response, you know that the current `refresh_token` is invalid.

When a `refresh_token` is invalid, you’ll want to re-authorize the app in order to obtain a valid `access_token` and continue with the request.

That being said, if you closely manage the storage of `access_tokens` and the relevant `refresh_tokens` such that your app is the only thing authorizing the users, you should be able to greatly minimize the number of times this happens.

I hope that helps! Let me know if you have any questions.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![chrismurrph](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chrismurrph/32/21804_2.png) [@chrismurrph](https://devforum.zoom.us/u/chrismurrph)\
**Post date:** [January 29, 2021, 9:34am UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/4 "2021-01-29T09:34:37Z")

</div>

Yes I am getting a 401 when trying to authorize:

status 401  
body {“reason”:“Invalid Token!”,“error”:“invalid\_request”}

So my question is now how do I ‘re-authorize the app’? Do I need to talk to a person or a page on your web site? Is there documentation for how you ‘re-authorize the app’?

---

<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:** [January 30, 2021, 7:50pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/5 "2021-01-30T19:50:51Z")

</div>

Hey @chrismurrph ,

> [@chrismurrph](#):
>
> So my question is now how do I ‘re-authorize the app’? Do I need to talk to a person or a page on your web site? Is there documentation for how you ‘re-authorize the app’?

To reauthorize the app you just install it again, or navigate to the install url! 🙂

Please see Step. 1: [https://marketplace.zoom.us/docs/guides/auth/oauth#step-1-request-user-authorization](https://marketplace.zoom.us/docs/guides/auth/oauth#step-1-request-user-authorization)

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![chrismurrph](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chrismurrph/32/21804_2.png) [@chrismurrph](https://devforum.zoom.us/u/chrismurrph)\
**Post date:** [January 30, 2021, 8:14pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/6 "2021-01-30T20:14:55Z")

</div>

I filled out the needed information and pressed the “Install” button. It then took me to a blank page:

Opening the browser console I can see this message:

Uncaught TypeError: Cannot read property ‘postMessage’ of null  
at oauth?provider=zoom&code=…

I was obviously in as the correct user (not this Panda Bear user), to be able to press the button.

I refreshed this page (where the “Install” button is):

[https://marketplace.zoom.us/develop/apps/gsJwNuabTPOo5x0YuzpfFQ/activation](https://marketplace.zoom.us/develop/apps/gsJwNuabTPOo5x0YuzpfFQ/activation)

Hoping to see an indication that the App had been installed/activated/authorised. But the page looks the same as before I pressed the button.

I also repeated the “Install” much later in an Incognito browser window, with the same result.

---

<div class="post-metadata">

**Author:** ![chrismurrph](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/chrismurrph/32/21804_2.png) [@chrismurrph](https://devforum.zoom.us/u/chrismurrph)\
**Post date:** [January 31, 2021, 6:35pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/7 "2021-01-31T18:35:32Z")

</div>

Not sure what was happening there with the “Install” button in my last post. But at [https://marketplace.zoom.us/docs/guides/auth/oauth#getting-access-token:](https://marketplace.zoom.us/docs/guides/auth/oauth#getting-access-token:)

```auto
https://zoom.us/oauth/authorize?...

```

It says “This URL is the same as the Install Button link on the Zoom App Marketplace.” I realised that our front-end must be initiating this URL so I triggered our front end and looked in the logs for the access\_token and refresh\_token. I found them - and the access\_token indeed works! So I now should have a valid refresh\_token that will work in an hours time…

Just editing here. The expired access\_token was detected and a new pair retrieved and saved to the database.

---

<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:** [February 1, 2021, 9:38pm UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/8 "2021-02-01T21:38:35Z")

</div>

Hey @chrismurrph,

Excellent! I’m glad to hear that everything seems to be working now. As always, feel free to reach out if you encounter any issues or questions. 🙂

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:** [March 4, 2021, 7:38am UTC](https://devforum.zoom.us/t/invalid-token-when-trying-to-refresh-token-to-get-a-new-access-token-refresh-token-pair/41813/9 "2021-03-04T07:38:51Z")

</div>

Closed on March 4, 2021, 7:38am UTC

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