# "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:** 4

<div class="post-metadata">

**Author:** ![KGEM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kgem/32/6563_2.png) [@KGEM](https://devforum.zoom.us/u/KGEM)\
**Post date:** [June 9, 2020, 10:22pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/62 "2020-06-09T22:22:29Z")

</div>

Hi @tommy,

We are calling this endpoint when we receive a participant joined callback and the participant’s access token is expired: `https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token={insertTokenHere}`

For only 2 of our users (out of hundreds of users), something seems to have gone wrong in the refresh process.

The users requested refresh as usual, and logs show that the refresh went through fine, and the token was stored. Looking at the refresh token also shows that its “exp” and “nbf” are reasonable. Furthermore, the users do not seem to have ever deauthorized our app.

I think the only way forward for these two users will be to contact them and ask them to re-install (correct me if I’m wrong).

My main concern, however, is that this happen to other users as well, which is why I’d like your help to determine the cause.

Thanks

---

<div class="post-metadata">

**Author:** ![michael.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael.zoom/32/37213_2.png) [@michael.zoom](https://devforum.zoom.us/u/michael.zoom)\
**Post date:** [June 12, 2020, 11:55pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/63 "2020-06-12T23:55:18Z")

</div>

@KGEM Direct messaged for details.

---

<div class="post-metadata">

**Author:** ![kresna.jenie](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kresna.jenie/32/10449_2.png) [@kresna.jenie](https://devforum.zoom.us/u/kresna.jenie)\
**Post date:** [June 14, 2020, 6:54am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/64 "2020-06-14T06:54:19Z")

</div>

Hi, I am developing an app when the user can’t reauthorize every time but it seems that my refresh token is always invalid when I try to get a new access token. I have tested the client id and it is valid. I have tried it for the past few days but it never seems to work. What is the solution?

---

<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:** [June 17, 2020, 6:32am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/65 "2020-06-17T06:32:50Z")

</div>

Hey @kresna.jenie,

Please provide steps to reproduce the issue so we can help. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![brettstubbs](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/brettstubbs/32/11677_2.png) [@brettstubbs](https://devforum.zoom.us/u/brettstubbs)\
**Post date:** [July 9, 2020, 9:23pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/66 "2020-07-09T21:23:08Z")

</div>

Same exact problem. I get the token and refresh. Tested my refresh functionality, and it seems to work the first time. Wait later, and run it again and get Invalid Token! message.

---

<div class="post-metadata">

**Author:** ![jagadeesh.devula](https://avatars.discourse-cdn.com/v4/letter/j/13edae/32.png) [@jagadeesh.devula](https://devforum.zoom.us/u/jagadeesh.devula)\
**Post date:** [July 13, 2020, 10:07am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/67 "2020-07-13T10:07:00Z")

</div>

Hi Tommy,  
In the Zoom production environment, how many days of access token will be alive without expired ?  
I mean 15 days or 1 month like that.

Thank you.

---

<div class="post-metadata">

**Author:** ![pablo.fredes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pablo.fredes/32/11314_2.png) [@pablo.fredes](https://devforum.zoom.us/u/pablo.fredes)\
**Post date:** [July 13, 2020, 4:39pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/69 "2020-07-13T16:39:04Z")

</div>

@tommy  
This is what is happenig to me also  
Could you help me with this issue?  
What fix it for @neecholai maybe is my same problem  
Thank you!

---

<div class="post-metadata">

**Author:** ![ryanau](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ryanau/32/11888_2.png) [@ryanau](https://devforum.zoom.us/u/ryanau)\
**Post date:** [July 14, 2020, 4:55pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/70 "2020-07-14T16:55:16Z")

</div>

@tommy  
Hi we’re seeing the same issue. We’re using a POST request and saving our latest refresh token every time we obtain a new access token. Would you be able to help me out? Thanks!

---

<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:** [July 16, 2020, 2:54pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/71 "2020-07-16T14:54:04Z")

</div>

@tommy We’re having a very similar issue. It seems like the Refresh Token is never any good. Here’s our scenario.

Do Auth to get an Access Token and a Refresh Token for user-level app and save to our database.  
Then either wait more than one hour or corrupt the AT in our DB so we no longer our a valid AT.  
Make a call to try to book a meeting using the AT, we get a 401 error. (expected.)  
Make a call to refresh the tokens passing the RT. We get a 401 error saying the token is invalid. (not expected and has worked in the past.)

---

<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 21, 2020, 4:42pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/74 "2020-07-21T16:42:20Z")

</div>

Hey @kkoellner, @ryanau, @pablo.fredes, @brettstubbs,

Are you still seeing this issue? Please try [reauthorizing your OAuth app](https://marketplace.zoom.us/docs/guides/auth/oauth#step-1-request-user-authorization) to reset the token flow.

One common reason this can happen is if a user Zoom OAuths with your app on a different device. If that happens, the original set of OAuth tokens will no longer be valid since Zoom only supports one valid refresh and access token at a time for a user.

Thanks,  
Tommy

---

<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 21, 2020, 4:43pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/75 "2020-07-21T16:43:14Z")

</div>

Hey @jagadeesh.devula,

The access token lasts for one hour. The latest refresh token lasts for 15 years.

> **[OAuth 2.0 - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/auth/oauth#step-2-request-access-token)**
>
> OAuth with Zoom
> 
> The Zoom API uses OAuth 2.0 to authenticate and authorize users to make requests. To setup access credentials and request scopes for yo...

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pablo.fredes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pablo.fredes/32/11314_2.png) [@pablo.fredes](https://devforum.zoom.us/u/pablo.fredes)\
**Post date:** [July 29, 2020, 6:14pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/76 "2020-07-29T18:14:16Z")

</div>

Yes @tommy still getting a error:  
Client error: `POST https://zoom.us/oauth/token` resulted in a `401 Unauthorized` response: {“reason”:“Invalid Token!”,“error”:“invalid\_request”}

Im using this app in my local machine and not using different devices…

---

<div class="post-metadata">

**Author:** ![pablo.fredes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pablo.fredes/32/11314_2.png) [@pablo.fredes](https://devforum.zoom.us/u/pablo.fredes)\
**Post date:** [July 29, 2020, 10:36pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/77 "2020-07-29T22:36:27Z")

</div>

@tommy  
I can register with the first auth token but the refresh token is always invalid.  
The webinar ID is 91308815810. Is it some configuration error on the Oauth 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:** [July 31, 2020, 7:21pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/78 "2020-07-31T19:21:56Z")

</div>

Hey @pablo.fredes,

Can you please provide steps to reproduce the issue? Due note, that you need to use the latest refresh token after each refresh request.

> **[OAuth 2.0 - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing)**
>
> OAuth with Zoom
> 
> The Zoom API uses OAuth 2.0 to authenticate and authorize users to make requests. To setup access credentials and request scopes for yo...

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pablo.fredes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pablo.fredes/32/11314_2.png) [@pablo.fredes](https://devforum.zoom.us/u/pablo.fredes)\
**Post date:** [July 31, 2020, 9:06pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/79 "2020-07-31T21:06:17Z")

</div>

Yes @tommy, here is what I got,  
I’m working with a Licensed account to manage Webinars.  
So I have a test Webinar created and the idea is to make a form for Registrant Webinars.  
I created a Oauth App in: [marketplace.zoom.us](http://marketplace.zoom.us).  
In my local machine I Login to zoom with my Licensed account and everything works well registering user with a form created,  
where I always use the access\_token unless the response gives me a 401 error,  
if that happens I try to request the “Refreshing an Access Token” like is documented, and that is where I’m stuck, is always given me the “Invalid Token” error.  
For the “Refreshing an Access Token” request

```
  $response = $clientr->request('POST', '/oauth/token', [
    "headers" => [
      "Authorization" => "Basic " . base64_encode(CLIENT_ID . ':' . CLIENT_SECRET),
    ],
    'form_params' => [
      "grant_type" => "refresh_token",
      "refresh_token" => $refresh_token,
    ],
  ]);

```

where $refresh\_token is the refresh token that I received when I got logged with the Licensed account the first time.

---

<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 3, 2020, 4:57pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/80 "2020-08-03T16:57:13Z")

</div>

Hey @pablo.fredes,

Please try the [OAuth and refresh flow](https://marketplace.zoom.us/docs/guides/auth/oauth) in [Postman](https://www.postman.com/) and see if it works. It could very well be a misconfiguration in your code.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pablo.fredes](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pablo.fredes/32/11314_2.png) [@pablo.fredes](https://devforum.zoom.us/u/pablo.fredes)\
**Post date:** [August 4, 2020, 9:07pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/81 "2020-08-04T21:07:39Z")

</div>

Hey @tommy!  
You were right!  
There was an error on my sql code, it was not updating correctly the refresh token in my DB.  
Thanks for the support!!

---

<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 5, 2020, 9:05pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/82 "2020-08-05T21:05:22Z")

</div>

Hey @pablo.fredes,

Happy to hear you figured out the issue! Let me know if you need anything else! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![greminders](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/greminders/32/60855_2.png) [@greminders](https://devforum.zoom.us/u/greminders)\
**Post date:** [September 1, 2020, 5:14am UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/83 "2020-09-01T05:14:32Z")

</div>

Hope this helps someone, basically the problem is the refreshtoken is updated everytime a new access token is called. So you need to update both on your end. Access Token AND refresh token. Otherwise you will get refresh token invalid if you use the original refresh 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:** [September 2, 2020, 9:50pm UTC](https://devforum.zoom.us/t/invalid-token-error-message-when-trying-to-refresh-oauth-token/13363/84 "2020-09-02T21:50:09Z")

</div>

Hey @greminders,

Thanks so much for jumping in and helping out—great context for our developers!

Best,  
Will

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

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