# After first try, OAuth app get "Invalid authorization code" error when request a new OAuth token

**URL:** <https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506>\
**Category:** API and Webhooks\
**Created:** [June 6, 2020, 3:26am UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506 "2020-06-06T03:26:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![heidi.zh.n](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/heidi.zh.n/32/2906_2.png) [@heidi.zh.n](https://devforum.zoom.us/u/heidi.zh.n)\
**Post date:** [June 6, 2020, 3:26am UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506/1 "2020-06-06T03:26:23Z")

</div>

Hello!

I created an OAuth app. After installing it, I got the authorization code.

Using this authorization code, I was able to get OAuth token at the first try. See the following logs.

```
2020-06-05 20:07:45.163 INFO 74688 --- [scheduling-1] c.o.o.e.n.q.i.s.p.ActivityMeetingProcess : Get Zoom OAuth: https://zoom.us/oauth/token?grant_type=authorization_code&code=olsDh8lp8w_yhMUmzNeQkyqlte7Etc8Bw&redirect_uri=https:/myredirecturl
2020-06-05 20:07:45.878 INFO 74688 --- [scheduling-1] c.o.o.e.n.q.i.s.p.ActivityMeetingProcess : Get OAuth: https://zoom.us/oauth/token?grant_type=authorization_code&code=olsDh8lp8w_yhMUmzNeQkyqlte7Etc8Bw&redirect_uri=https://myredirecturl 200 {"access_token":"..","token_type":"bearer","refresh_token":"...","expires_in":3599,"scope":"dashboard_meetings:read:admin meeting:write:admin"}

```

After one minute, I use the same authorization code and try to get a new OAuth token. However, I got 400 with “Invalid authorization code”

```
2020-06-05 20:08:46.609 INFO 74688 --- [scheduling-1] c.o.o.e.n.q.i.s.p.ActivityMeetingProcess : Get Zoom OAuth: https://zoom.us/oauth/token?grant_type=authorization_code&code=olsDh8lp8w_yhMUmzNeQkyqlte7Etc8Bw&redirect_uri=https://myredirecturl
2020-06-05 20:08:47.313 ERROR 74688 --- [scheduling-1] c.o.o.e.n.q.i.s.p.ActivityMeetingProcess : fail to get OAuth: https://zoom.us/oauth/token?grant_type=authorization_code&code=olsDh8lp8w_yhMUmzNeQkyqlte7Etc8Bw&redirect_uri=https://myredirecturl 400 Bad Request {"reason":"Invalid authorization code olsDh8lp8w_yhMUmzNeQkyqlte7Etc8Bw","error":"invalid_request"}

```

No matter how many times I tried, with this authorization code, I got the same error. I didn’t reinstall the app to generate a new authorization code.

Could you explain to me why this happen? Thank you.

---

<div class="post-metadata">

**Author:** ![heidi.zh.n](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/heidi.zh.n/32/2906_2.png) [@heidi.zh.n](https://devforum.zoom.us/u/heidi.zh.n)\
**Post date:** [June 8, 2020, 9:18pm UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506/2 "2020-06-08T21:18:39Z")

</div>

Hello! Zoom team,

Can you help on this issue?

---

<div class="post-metadata">

**Author:** ![heidi.zh.n](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/heidi.zh.n/32/2906_2.png) [@heidi.zh.n](https://devforum.zoom.us/u/heidi.zh.n)\
**Post date:** [June 8, 2020, 10:33pm UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506/3 "2020-06-08T22:33:15Z")

</div>

I got the Auth code by clicking “Install” on the following page

 ![Screen Shot 2020-06-08 at 3.02.48 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/5/5509d5b3a2f879533faa391d2b33478b5296bbec.png)

The I was redirected to the following page which has the code in the URL.

 ![Screen Shot 2020-06-08 at 3.21.53 PM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/2X/1/1a490bcd99b799bad937ea57148bbf14df9296ad.png)

---

<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 12, 2020, 6:09pm UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506/4 "2020-06-12T18:09:18Z")

</div>

Hey @heidi.zh.n,

This is the expected flow. The auth code can only be used once to get an access token.

To refresh your access token, please follow the [refresh flow](https://marketplace.zoom.us/docs/guides/auth/oauth#refreshing), or direct the user to [install / authorize the app again](https://marketplace.zoom.us/docs/guides/auth/oauth#step-1-request-user-authorization).

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, 10:01pm UTC](https://devforum.zoom.us/t/after-first-try-oauth-app-get-invalid-authorization-code-error-when-request-a-new-oauth-token/20506/5 "2020-08-21T22:01:01Z")

</div>


