# 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:** 11\
**Page:** 5

<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:** [May 21, 2020, 11:25pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/83 "2020-05-21T23:25:18Z")

</div>

Hey @randers,

All these issues are currently issues with how developers are implementing the OAuth flow. There are no confirmed issues on Zoom’s side.

Please share more details about your issue and steps to reproduce so we can help. 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![muhammad.faizan.cs](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/muhammad.faizan.cs/32/4144_2.png) [@muhammad.faizan.cs](https://devforum.zoom.us/u/muhammad.faizan.cs)\
**Post date:** [September 10, 2020, 8:39am UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/85 "2020-09-10T08:39:10Z")

</div>

I have an app, that stores refreshToken and accessToken and I only refresh when a token is expired while user is performing an action and then i store new token back.  
In the recent test, I authorized my app 2 days ago, used it once and then didn’t touch it again. (means no activity in zoom)  
Then after 2-3 days when I tried to use my app and create a request to refresh token I received error that my token is expired. Which is beyond me. Because Its not the case where a new token is generated. Only I authorize my app and I haven’t touched it. as you stated that refreshToken have 15 years of expiry I highly doubt that. In case you want to investigate further, I can provide my zoom account that was authorized for the app I developed. And check the logs against it that either the request to refresh token was generated or the refreshToken was invalid itself.  
Here is my code in Javascript that refreshes the token. I am using “axios” so auth object creates Basic Auth token.

```
return request.post(`/oauth/token?grant_type=refresh_token&refresh_token=${refreshToken}`, {}, {
    auth: {
      username: process.env.ZOOM_CLIENT_ID,
      password: process.env.ZOOM_SECRET
    }
  })
```

---

<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 14, 2020, 6:19pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/86 "2020-09-14T18:19:20Z")

</div>

Hi @muhammad.faizan.cs,

Thanks for providing these details—and happy to look into this for you. In order to check on this, can you email us the following details to [developersupport@zoom.us](mailto:developersupport@zoom.us):

- Refresh Token in question
- Account ID

Thanks!  
Will

---

<div class="post-metadata">

**Author:** ![surya](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/surya/32/17247_2.png) [@surya](https://devforum.zoom.us/u/surya)\
**Post date:** [December 18, 2020, 12:59pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/87 "2020-12-18T12:59:47Z")

</div>

**I am getting 404 bad request error or 401 unauthorized error while refreshing token**  
Following is the url used.  
[https://zoom.us/oauth/token?grant\_type=refresh\_token&refresh\_token=](https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=)

Headers:  
Authorization:Basic base64(clientid:clientsecret)  
Content-Type:application/x-www-form-urlencoded

---

<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:** [December 18, 2020, 9:25pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/88 "2020-12-18T21:25:53Z")

</div>

Hi @surya,

Can you confirm that you’re using the latest access\_token and refresh\_token? Please note that when you retrieve an access\_token, a new refresh token is provided as well. Similarly, if you use a refresh token once, you will need to request a fresh one from your most recent request.

In other words, both the access token and refresh tokens are updated each time you retrieve them, so you need to make sure you’re using the latest.

Can you double check this and let me know?

Thanks!  
Will

---

<div class="post-metadata">

**Author:** ![surya](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/surya/32/17247_2.png) [@surya](https://devforum.zoom.us/u/surya)\
**Post date:** [December 19, 2020, 10:38am UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/89 "2020-12-19T10:38:15Z")

</div>

Hi Will,

I am using the most recent refresh token generated jst now.

 ![image.png](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/d/6d8792cc6c479af3e554b70d09385fa7dbc7557e.png)

And following is the header I am using

\*\*Authorization:Basic \*\*

This is giving me a bad request.

And even when I am creating a meet request ,it is giving me unauthorized error.

Please help me.

---

<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:** [December 21, 2020, 11:30pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/90 "2020-12-21T23:30:59Z")

</div>

Hey @surya,

Thank you for providing additional information. First, I would try using a Content-Type of `application/json`. I also decoded the refresh\_token that you used and it didn’t seem to be valid. Where are you getting that refresh\_token from and can you confirm that there are no issues introduced when copying and pasting the token?

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![brajanek](https://avatars.discourse-cdn.com/v4/letter/b/13edae/32.png) [@brajanek](https://devforum.zoom.us/u/brajanek)\
**Post date:** [March 31, 2021, 10:59am UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/91 "2021-03-31T10:59:47Z")

</div>

But this is nonsense! The refresh tokens by definition should be long-lived so what’s the point in making them available for usage only once? The refresh token is valid for 15 years but it can be used only once in this period and then must be replaced by a new one. What’s the point of the refresh token then? To use it once in 15 years? Can anybody explain to me this nonsense design?

---

<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:** [March 31, 2021, 5:39pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/92 "2021-03-31T17:39:52Z")

</div>

Thanks for the feedback @brajanek.

To clarify, the purpose of the refresh token is to request a new access token. Although the refresh token expires after 15 years, it becomes invalid after it is used to request a new access token. You will receive a new refresh token pair and an access token once you use the old refresh token. You will have to update these old values with new ones. These details are covered [here](https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing) as well.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![mango](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@mango](https://devforum.zoom.us/u/mango)\
**Post date:** [July 5, 2021, 4:44am UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/93 "2021-07-05T04:44:13Z")

</div>

Hi, we have got the same issue.

Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://zoom.us/oauth/token` resulted in a `401 Unauthorized` response: {“reason”:“Invalid Token!”,“error”:“invalid\_request”}

we have checked the scope, credentials, secret key, using the latest token but still no luck.

can we pm you the detail ?

Thanks in advance!

---

<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:** [July 6, 2021, 6:11pm UTC](https://devforum.zoom.us/t/refresh-token-request-failing-with-401/6447/94 "2021-07-06T18:11:03Z")

</div>

@mango,

Have you checked that the value you’re passing in your authorization header matches the credentials for your oauth app?

Thanks,  
Will

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