# Failure to refresh oauth access\_token

**URL:** <https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395>\
**Category:** API and Webhooks\
**Created:** [January 8, 2020, 6:12pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395 "2020-01-08T18:12:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![josh.day](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/josh.day/32/2826_2.png) [@josh.day](https://devforum.zoom.us/u/josh.day)\
**Post date:** [January 8, 2020, 6:12pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/1 "2020-01-08T18:12:48Z")

</div>

**Description**  
Similar to this question ([Requesting Access Token via Python](https://devforum.zoom.us/t/requesting-access-token-via-python/6637/10)) I desire to use oauth token to periodically hit the API. I have a (valid for next 30 minutes or so) access\_token and a refresh\_token associated with my never-going-to-be-published app.

**Error**  
When using recommended syntax with curl I’m hitting an “Internal Error” with “invalid\_request”

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

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

**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:

1. Make private app, with non-existent redirect URL since this will not be published for use by real users
2. Use client\_id and client\_secret to generate initial access\_token and refresh\_token via API test webpage.
3. Based on API docs, generate request using client\_id, client\_secret, and refresh\_token to get a new access\_token
4. `curl -X POST -H "Content-Type:application/x-www-form-urlencoded" --user <id>:<secret> --data 'grant_type=refresh_token&refresh_token=<refresh_token_here>' https://zoom.us/oauth/token`
5. See error: `{"reason":"Internal Error","error":"invalid_request"}`

**Additional context**  
I feel this may be because I’ve not published the app (and don’t plan to). In the case that this is the issue, what can I do to generate a new access\_token?

---

<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 8, 2020, 10:45pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/2 "2020-01-08T22:45:22Z")

</div>

Hey @josh.day, thanks for posting and using Zoom!

It appears your curl request is malformed.

Try using this request:

```auto
curl -X POST --user <id>:<secret> https://zoom.us/oauth/token?grant_type=refresh_token&refresh_token=REFRESH_TOKEN_HERE

```

[To get another access\_token, reinstall your app and follow these steps.](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom)

If your api requests are going to be internal to your Zoom account and always going to be on curl, I would suggest using a [JWT Token](https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-jwt-app) instead of OAuth so you won’t have to refresh your tokens.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![josh.day](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/josh.day/32/2826_2.png) [@josh.day](https://devforum.zoom.us/u/josh.day)\
**Post date:** [January 8, 2020, 11:04pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/3 "2020-01-08T23:04:27Z")

</div>

@tommy – I’m still getting the same HTTP 400 error, unfortunately. And using JWT is not an option as my organization won’t allow.

---

<div class="post-metadata">

**Author:** ![josh.day](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/josh.day/32/2826_2.png) [@josh.day](https://devforum.zoom.us/u/josh.day)\
**Post date:** [January 8, 2020, 11:08pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/4 "2020-01-08T23:08:41Z")

</div>

Full error:  
`<!doctype html><html lang="en"><head><title>HTTP Status 400 – Bad Request</title><style type="text/css">h1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} h2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} h3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} b {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} p {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;} a {color:black;} a.name {color:black;} .line {height:1px;background-color:#525D76;border:none;}</style></head><body><h1>HTTP Status 400 – Bad Request</h1><hr class="line" /><p><b>Type</b> Exception Report</p><p><b>Message</b> Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986</p><p><b>Description</b> The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).</p><p><b>Exception</b></p><pre>java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986 org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:479) org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684) org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:748) </pre><p><b>Note</b> The full stack trace of the root cause is available in the server logs.</p><hr class="line" /><h3>Apache Tomcat/8.5.39</h3></body></html>`

---

<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 9, 2020, 12:07am UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/5 "2020-01-09T00:07:54Z")

</div>

Hey @josh.day,

It seems your request is still malformed. Can you private message me the whole curl command you are using that produces that error?

Thanks,  
Tommy

---

<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, 7:10pm UTC](https://devforum.zoom.us/t/failure-to-refresh-oauth-access-token/7395/6 "2020-08-21T19:10:58Z")

</div>


