# Refresh token request failing with 401

**URL:** <https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447>\
**Category:** API and Webhooks\
**Created:** [October 29, 2019, 6:21pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447 "2019-10-29T18:21:43Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 6:21pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/1 "2019-10-29T18:21:44Z")

</div>

**Description/Error**  
POST to [https://zoom.us/oauth/token?grant\_type=refresh\_token&refresh\_token={refresh\_token}&redirect\_uri={redirect\_uri}](https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=%7Brefresh_token%7D&redirect_uri=%7Bredirect_uri%7D)

header: Authorization : Basic base64{clientid:clientsecret}

failing with  
(401) {“reason”:“Invalid Token!”,“error”:“invalid\_request”}

**Additional context**  
We are always storing and reusing the refresh token

also tried curl request with same results:  
curl -X POST -H “Content-Type:application/x-www-form-urlencoded” --user {client\_id}:{client\_secret} --data ‘grant\_type=refresh\_token&refresh\_token={refresh\_token}’ [https://zoom.us/oauth/token](https://zoom.us/oauth/token)

Finally I also tried uninstalling and reinstalling the app which gave a new access token but the same refresh token. Refresh requests are still failing.

---

<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:** [October 29, 2019, 6:33pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/2 "2019-10-29T18:33:06Z")

</div>

Hey @ps40,

Are you storing and using the new refresh token every time?

Each time you refresh, a new refresh token is returned which must be used for the next refresh.

“Refresh Tokens have a lifespan of 15 years. When you refresh an access token, you will also get a new refresh token that you need to use in your next refresh. Store the new refresh token safely for the next time when you try to refresh the tokens.”

> **[OAuth with Zoom - OAuth - Authorization - Documentation](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom#refresh-access-token)**
>
> OAuth with Zoom
> 
> 
> 
> Below are examples of how to send requests for Access Tokens and handle responses for OAuth app authentication and authorization with...

Let me know.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 6:38pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/3 "2019-10-29T18:38:58Z")

</div>

Yes, I read all posts related to this issue. Yes, we are storing and reusing the refresh token everytime.

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 6:39pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/4 "2019-10-29T18:39:38Z")

</div>

Also, all of this was verified and working until recently.

---

<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:** [October 29, 2019, 6:47pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/5 "2019-10-29T18:47:39Z")

</div>

Hey @ps40,

Can you try using the one of your previous refresh tokens to see if that fixes the issue?

Also if you could share the log of when it failed [found here](https://marketplace.zoom.us/user/logs) that would be great.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 29, 2019, 6:59pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/6 "2019-10-29T18:59:00Z")

</div>

I am also getting this error and I am also doing everything as documented. Not only that but the logs as linked above do not show the errors. It seems like its failing at the auth stage on [zoom.us](http://zoom.us) side.

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 7:18pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/7 "2019-10-29T19:18:18Z")

</div>

Hello,

We only store the most recent refresh token. Also, as far as I can tell, the refresh token is not changing, even if we re-authorize the app.

In the log you mentioned, I found only this and I am not sure if it is related:

{

“endpoint”: “[https://api.zoom.us/v2/users/kNCkx7C\_QF61MAl8NIBc7Q](https://api.zoom.us/v2/users/kNCkx7C_QF61MAl8NIBc7Q)”,

“response\_headers”: [

“Set-Cookie: cred=B2891FE44C3B323D0C8347E76754CF5F; Path=/; Secure; HttpOnly”

],

“date\_time”: “2019-10-29 15:15:26”,

“method”: “GET”,

“request\_body”: “N/A”,

“response”: {

“code”: 1001,

“message”: “User not exist: kNCkx7C\_QF61MAl8NIBc7Q”

},

“request\_headers”: [

“accept-encoding: gzip”,

“authorization: \*\*\*\*\*\*”,

“connection: close”,

“user-agent: Go-http-client/1.1”

],

“request\_params”: [

],

“http\_status”: “404”

}

---

<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:** [October 29, 2019, 7:21pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/8 "2019-10-29T19:21:28Z")

</div>

Hey @ps40 and @shane.zoom, are you able to reproduce the issue?

Or does it only happen sometimes at random?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 7:22pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/9 "2019-10-29T19:22:14Z")

</div>

Yes, it is reproducible 100% of the time. I am simply unable to refresh the token anymore.

---

<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:** [October 29, 2019, 7:28pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/10 "2019-10-29T19:28:42Z")

</div>

Can you hop on a Zoom meeting with me so I can see what’s happening?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 29, 2019, 7:31pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/11 "2019-10-29T19:31:34Z")

</div>

Our users have reported it to be random.

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 7:33pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/12 "2019-10-29T19:33:44Z")

</div>

Yes, sure. I created a meeting using the link you provided.

---

<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:** [October 29, 2019, 7:35pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/13 "2019-10-29T19:35:26Z")

</div>

Thanks, I updated the calendly settings to allow same day bookings if you want to meet today @ps40.

@shane.zoom, can you share more details? What percent of the time is it failing, and do you see any error logs here: [https://marketplace.zoom.us/user/logs](https://marketplace.zoom.us/user/logs)?

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 29, 2019, 7:45pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/14 "2019-10-29T19:45:38Z")

</div>

I don’t see any failed logs in that link you gave me. But we do log errors to zoomus failing on our own end. Here is from oct 23 to oct 26 with timestamp:

> Oct 23 17:33:02 - unable to refresh token  
> Oct 24 10:46:35 - unable to refresh token  
> Oct 24 12:26:30 - unable to refresh token  
> Oct 24 13:06:15 - unable to refresh token  
> Oct 25 11:37:36 - unable to refresh token  
> Oct 25 12:32:42 - unable to refresh token  
> Oct 26 10:36:00 - unable to refresh token

Message logged when refresh token api call to zoomus fails. And the error from [zoom.us](http://zoom.us) is

> reason  
> Invalid Token!  
> error  
> invalid\_request

---

<div class="post-metadata">

**Author:** ![ps40](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@ps40](https://devforum.zoom.us/u/ps40)\
**Post date:** [October 29, 2019, 7:52pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/15 "2019-10-29T19:52:11Z")

</div>

I created a meeting for today. Please cancel the one for tomorrow.

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 29, 2019, 8:04pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/16 "2019-10-29T20:04:47Z")

</div>

I should note that, to get around the issue temporarily, we ask the user to re do the authorization process by forwarding them to the authorization url. Which is definitely not ideal for us.

---

<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:** [October 29, 2019, 9:49pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/17 "2019-10-29T21:49:48Z")

</div>

Hey @shane.zoom,

That is what @ps40 did and it fixed the issue.

2 Reasons this could happen:

1. The app scopes were changed so the user needed to update or re install the app.  
Or.
2. The refresh\_token was not saved properly on your end so the next time you went to refresh the access\_token it used an old refresh\_token, hence the error.

Let me know if any of the two could have happened on your end. If not I will check the Zoom logs to see why the refresh failed.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 30, 2019, 6:50pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/18 "2019-10-30T18:50:17Z")

</div>

Hey I’m investigating further on if we are not saving the refresh token properly. But could you explain step 1. I am not too sure what that involves. It’s a time sensitive issue at the moment due to not being able to create [zoom.us](http://zoom.us) meeting. So if there are any logs that you may find as well it would be helpful as well. Thanks.

---

<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:** [October 30, 2019, 7:20pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/19 "2019-10-30T19:20:14Z")

</div>

Hey @shane.zoom,

When you change the Scopes of your app, or Event Subscriptions, this will require users to update your app to approve the additional scope change because you are accessing additional data. Once they approve, it restarts the [authorization flow in which you need to get a new access and refresh token](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom#authorization-code) and update your database.

If users choose not to update, the application, access, and refresh token will still work as expected, but your app won’t be able to access the newly request data in the scope change.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![shane.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/shane.zoom/32/925_2.png) [@shane.zoom](https://devforum.zoom.us/u/shane.zoom)\
**Post date:** [October 30, 2019, 7:34pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/20 "2019-10-30T19:34:43Z")

</div>

Hey @tommy. Thanks for the explanation. I just looked into the code and tested it more. We are saving the new refresh token. I talked to someone internally who has told me that he hasn’t ran into this issue last few weeks which perhaps rule out the app scope issue. And I don’t believe the scope was being changed every day. Is it entirely possible that it could be user account related?

[Next page](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447.md?page=2)
