# oAuth and create Meeting (error 400)

**URL:** <https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647>\
**Category:** API and Webhooks\
**Created:** [March 14, 2020, 12:40am UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647 "2020-03-14T00:40:30Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![pgtaboada](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pgtaboada/32/3562_2.png) [@pgtaboada](https://devforum.zoom.us/u/pgtaboada)\
**Post date:** [March 14, 2020, 12:40am UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/1 "2020-03-14T00:40:30Z")

</div>

**Description**  
I am having issues creating a meeting through API.

My workflow:

- I store the code in the user profile
- for each call…
  - I try request a new access\_token using the code stored in the profile
  - I try use the access\_token to create a new meeting

**Error**

I wish I had any error message to provide. I am mostly getting an code 400 result, no explanation whatsoever

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

OAuth

**My code**

```
private AccessToken createToken(User user) throws Exception {
    String submitUrl = new StringBuilder("https://zoom.us/oauth/token")
            .append("?grant_type=").append("authorization_code")
            .append("&code=").append(user.getZoomToken())
            .append("&redirect_uri=").append("https://abcd.ngrok.io/zoom/auth")
            .toString();
    Executor ex = Executor.newInstance(httpClient);

    Response response = ex.execute(
            Request.Post(submitUrl).addHeader("Authorization", "Basic " + zoomAppSecret))
    );
    
    final String responseAsString = response.returnContent().asString(Consts.UTF_8);
    AccessToken accessToken = mapper.readValue(responseAsString, AccessToken.class);
    return accessToken;
}
```

---

<div class="post-metadata">

**Author:** ![pgtaboada](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pgtaboada/32/3562_2.png) [@pgtaboada](https://devforum.zoom.us/u/pgtaboada)\
**Post date:** [March 16, 2020, 11:59am UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/2 "2020-03-16T11:59:57Z")

</div>

got it running, no need to answer

---

<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:** [March 16, 2020, 9:26pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/3 "2020-03-16T21:26:01Z")

</div>

Happy to hear you got it working!

Feel free to post the solution so other developers can benefit!

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![pgtaboada](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/pgtaboada/32/3562_2.png) [@pgtaboada](https://devforum.zoom.us/u/pgtaboada)\
**Post date:** [March 17, 2020, 4:08pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/4 "2020-03-17T16:08:35Z")

</div>

It was a misunderstanding of the workflow on my side. All oAuth workflows I had implemented until now had me re-generating tokens when they expired.

I did not understand why I could not re-generate a token once it was expired, now I understand I have to use the expiration token for that.

It makes the token management a little bit harder, as I have to store much more data on my end, and honestly, I am not sure if this is better from a security perspective. 😉

It is the first time I have to store…

- app credentials
- creation date (so I can calculate expiration)
- token
- expiration token for renewal
- user id

but it is up and running now. It just took me a few more roundtrips to get it up and running.

brgds

Papick

---

<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:** [March 17, 2020, 5:59pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/5 "2020-03-17T17:59:27Z")

</div>

Hey @pgtaboada,

That is correct.

At a minimum you’d need to store the access\_token, refresh\_token, user\_id, and expires\_in.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![efysegal](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/efysegal/32/10930_2.png) [@efysegal](https://devforum.zoom.us/u/efysegal)\
**Post date:** [June 29, 2020, 3:07pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/6 "2020-06-29T15:07:19Z")

</div>

Hi tommy,

I’m struggling as well to get access token  
After successfully getting the User Authorization Code, I failed to get the Access Token !  
My Code:  
String uri = “[https://zoom.us/oauth/token?grant\_type=authorization\_code&code=](https://zoom.us/oauth/token?grant_type=authorization_code&code=)” + zoom\_code + “&redirect\_uri=” + WEB\_PREFIX + ACCOUNT\_SERVER\_URL + “/access\_token.php”;  
URL url = new URL(uri);  
HttpURLConnection connection = (HttpURLConnection) url.openConnection();  
connection.setRequestProperty(“Content-Type”, “application/json”);  
connection.setRequestMethod(“POST”);  
String client\_id\_and\_secret = “PaVU8EC8QCGR7CLwcdWDUA:lCtfhplFmbl4yLbl4YLH8opejiy3gWvz”;  
byte results = client\_id\_and\_secret.getBytes(UTF\_8);  
connection.setRequestProperty(“Authorization”, "Basic " + new String(Base64.encode(results, Base64.NO\_WRAP)));  
resCode = connection.getResponseCode();

The resCode I get is either 403 or 401 or 400

Please advide,  
Thank you,  
Efy

---

<div class="post-metadata">

**Author:** ![efysegal](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/efysegal/32/10930_2.png) [@efysegal](https://devforum.zoom.us/u/efysegal)\
**Post date:** [June 29, 2020, 3:30pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/7 "2020-06-29T15:30:19Z")

</div>

OK Tommy,

I managed to solve the problem.  
In your documentation:  
" HEADERS: `{"Authorization": "Basic {BASE64ENCODED_CLIENT_ID}:{BASE64ENCODED_CLIENT_SECRET}"}`"  
You mislead us a bit as the true answer is:  
" HEADERS: `{"Authorization": "Basic BASE64ENCODED(CLIENT_ID:CLIENT_SECRET)"}`"

Please fix it in - [Error in Refreshing with refresh tokens](https://devforum.zoom.us/t/error-in-refreshing-with-refresh-tokens/5163/5)

BR,  
Efy

---

<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:** [June 30, 2020, 10:14pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/8 "2020-06-30T22:14:03Z")

</div>

Hey @efysegal,

Thanks for pointing that out! It is now fixed! 🙂

-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, 10:31pm UTC](https://devforum.zoom.us/t/oauth-and-create-meeting-error-400/8647/9 "2020-08-21T22:31:21Z")

</div>

Closed on August 21, 2020, 10:31pm UTC


