# oAuth 2.0  refresh\_token fail

**URL:** <https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753>\
**Category:** API and Webhooks\
**Created:** [September 21, 2018, 8:27am UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753 "2018-09-21T08:27:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Teacher](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Sam\_Teacher](https://devforum.zoom.us/u/Sam_Teacher)\
**Post date:** [September 21, 2018, 8:27am UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753/1 "2018-09-21T08:27:39Z")

</div>

I have obtained a valid access token. like this:

{  
“access\_token”: “eyJhbGciOiJIUzUxMiJ9jNWVjIn0.9bhbYhldRA”,  
“token\_type”: “bearer”,  
“refresh\_token”: “eyJhbGciOiJIUzUxMiJ9.eyJhdWQM3bFZEZlRgtKEb7pjqIA”,  
“expires\_in”: 3599,  
“scope”: "user:write:admin user:read:admin recording:write:admin dashboard:read:admin report:read:admin "  
}

But token can only be used for an hour, and it will fail.

So, I want to refresh the token, but keep reporting errors, as shown below:

\<html\>  
&nbsp; &nbsp; \<head\>\<title\>400 Bad Request\</title\>\</head\>  
&nbsp; &nbsp; \<body bgcolor=“white”\>  
&nbsp; &nbsp; &nbsp; &nbsp; \<center\>\<h1\>400 Bad Request\</h1\>\</center\>  
&nbsp; &nbsp; &nbsp; &nbsp; \<hr\>\<center\>nginx\</center\>  
&nbsp; &nbsp; \</body\>  
\</html\>

=========================================================

Here’s my implementation:&nbsp;I developed the application using the Java language.

String clientWord = zoomClientId + “:” + zoomClientSecret;  
// base64 encode  
String encodedText = base64.encodeToString(clientWord.getBytes(“UTF-8”));  
// add “Basic” (like obtain an OAuth token opt)  
String base64ClientWord = "Basic " + encodedText;  
// send http post  
HttpPost httpPost = new HttpPost(“[https://zoom.us/oauth/token?grant\_type=refresh\_token&refresh\_token=](https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=)” + refreshToken);  
httpPost.setHeader(“Content-Type”, “application/x-www-form-urlencoded”);  
// add header ahth  
httpPost.setHeader(“Authorization”, base64ClientWord);  
response = httpClient.execute(httpPost);

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [September 21, 2018, 8:58pm UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753/2 "2018-09-21T20:58:30Z")

</div>

Hi Sam,&nbsp;

I just tried the refresh token using POSTman and it worked on my end. Just replace the refresh token with yours and Basic with your clientID & clientSecret.&nbsp;

curl -X POST \  
‘[https://zoom.us/oauth/token?grant\_type=refresh\_token&refresh\_token=eyJhbGciOidfeffef](https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=eyJhbGciOidfeffef)’ \  
-H ‘Authorization: Basic RkxoSWxOUTJgddgdfgdfgdf’ \  
-H ‘Cache-Control: no-cache’ \

Have you tried making a curl command or using within POSTman?

Thanks

---

<div class="post-metadata">

**Author:** ![Sam\_Teacher](https://avatars.discourse-cdn.com/v4/letter/s/898d66/32.png) [@Sam\_Teacher](https://devforum.zoom.us/u/Sam_Teacher)\
**Post date:** [September 26, 2018, 7:32am UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753/3 "2018-09-26T07:32:30Z")

</div>

Thanks Nigel for responding.&nbsp;I executed both my program and curl command successfully,

but I don’t know why the previous operation&nbsp; always failed.

Should the authorization of the production environment be updated every hour?&nbsp;&nbsp;

It would be troublesome to update the token hourly after my application is released.

---

<div class="post-metadata">

**Author:** ![michael\_p.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/michael_p.zoom/32/18105_2.png) [@michael\_p.zoom](https://devforum.zoom.us/u/michael_p.zoom)\
**Post date:** [October 1, 2018, 10:07pm UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753/4 "2018-10-01T22:07:47Z")

</div>

Hi Sam,&nbsp;

After the access token has expired usually after an hour, you will need to use the refresh token to get a new access token to make additional calls. For enterprise security reasons tokens have a short lifespan to prevent any unauthorized usage.&nbsp;

Thanks

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 5:55pm UTC](https://devforum.zoom.us/t/oauth-2-0-refresh-token-fail/1753/5 "2020-08-21T17:55:37Z")

</div>

Closed on August 21, 2020, 5:55pm UTC


