# Oauth flow gives Invalid authorization code error \[resolved\]

**URL:** <https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440>\
**Category:** API and Webhooks\
**Created:** [May 28, 2020, 6:30pm UTC](https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440 "2020-05-28T18:30:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kieran.huggins](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kieran.huggins/32/9347_2.png) [@kieran.huggins](https://devforum.zoom.us/u/kieran.huggins)\
**Post date:** [May 28, 2020, 6:30pm UTC](https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440/1 "2020-05-28T18:30:43Z")

</div>

**Description**  
When trying to use the oauth flow, I keep getting an `Invalid authorization code` error when trying to do the code -\> token exchange

**Error**  
response from zoom api:

```auto
{"reason":"Invalid authorization code [code from the oauth step]","error":"invalid_request"}

```

request sent:

```auto
:body=>
  {"client_id"=>"[confirmed correct, also tried without this field]",
   "client_secret"=>"[confirmed correct, also tried without this field]",
   :redirect_uri=>
    "https://[ngrok id].ngrok.io/api/v2/auth/zoom/callback",
   :grant_type=>"authorization_code",
   :code=>"[confirmed correct]"},
 :headers=>
  {"Content-Type"=>"application/x-www-form-urlencoded",
   :Authorization=>
    "Basic RHFTTmN[..snip..]ZHgzb3NpeXYwUA=="}}

```

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
Using the OAuth endpoint - we need to auth 3rd parties

**Additional context**  
I see mention of “development credentials” in other threads, but I only see production credentials in the oauth app. Do I need different credentials for testing?

---

<div class="post-metadata">

**Author:** ![kieran.huggins](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/kieran.huggins/32/9347_2.png) [@kieran.huggins](https://devforum.zoom.us/u/kieran.huggins)\
**Post date:** [May 29, 2020, 5:56pm UTC](https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440/2 "2020-05-29T17:56:35Z")

</div>

I found that sending the code as a POST body seemed to be causing the error - changing to URL query params solved the issue for me

---

<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 4, 2020, 6:46am UTC](https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440/3 "2020-06-04T06:46:35Z")

</div>

Hey @kieran.huggins,

Happy to hear you figured out the issue! 🙂

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, 9:51pm UTC](https://devforum.zoom.us/t/oauth-flow-gives-invalid-authorization-code-error-resolved/19440/4 "2020-08-21T21:51:44Z")

</div>


