Failure to refresh oauth access_token

Description
Similar to this question (Requesting Access Token via Python) 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

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?

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

It appears your curl request is malformed.

Try using this request:

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.

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 instead of OAuth so you won’t have to refresh your tokens.

Thanks,
Tommy

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

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>

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