# Getting token fails due to invalid authorization code

**URL:** <https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454>\
**Category:** API and Webhooks\
**Tags:** api\
**Created:** [July 7, 2023, 5:04am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454 "2023-07-07T05:04:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![zoom-app-public](https://avatars.discourse-cdn.com/v4/letter/z/d6d6ee/32.png) [@zoom-app-public](https://devforum.zoom.us/u/zoom-app-public)\
**Post date:** [July 7, 2023, 5:04am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/1 "2023-07-07T05:04:14Z")

</div>

I published my Zoom app on the Marketplace.  
While monitoring the log, I found an error log that failed to getting an access token.

Below is the relevant part of the log.

400 Bad Request:  
“reason”: “Invalid authorization code”  
“error”": “invalid\_grant”

I get the access token with the following URL.  
[https://zoom.us/oauth/token?code=](https://zoom.us/oauth/token?code=)[Acquired authorization code]&grant\_type=authorization\_code&redirect\_uri=[Our redirect uri]

We don’t use PKCE.

When I install the app from the marketplace it was successful.  
Some of my customers seem to have this problem.

What could be causing the access token acquisition to fail?  
Please let me know if there is an investigation method.

Thank you in advance for your cooperation.

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [July 7, 2023, 7:17am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/2 "2023-07-07T07:17:08Z")

</div>

The authorization code is a one time use code only. if you use it again, it will give you an error.

You need to have the user authorize the app again to get a new authorization code, or if you have a refresh token, then you need to use the refresh token to get a new access token

---

<div class="post-metadata">

**Author:** ![zoom-app-public](https://avatars.discourse-cdn.com/v4/letter/z/d6d6ee/32.png) [@zoom-app-public](https://devforum.zoom.us/u/zoom-app-public)\
**Post date:** [July 7, 2023, 8:25am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/3 "2023-07-07T08:25:29Z")

</div>

Thank you for your reply.

I don’t think the normal marketplace installation process will require you to authenticate twice.  
Does it happen if you copy the URL and enter it through the browser?

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [July 7, 2023, 2:42pm UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/4 "2023-07-07T14:42:56Z")

</div>

My apologies, I should have been more clear, by authorizing again, I meant, the user clicking on the publishable URL. Every time a user clicks on the publishable URL, it will be a new authorization code

---

<div class="post-metadata">

**Author:** ![zoom-app-public](https://avatars.discourse-cdn.com/v4/letter/z/d6d6ee/32.png) [@zoom-app-public](https://devforum.zoom.us/u/zoom-app-public)\
**Post date:** [July 10, 2023, 5:02am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/5 "2023-07-10T05:02:25Z")

</div>

I understood that every time a user clicks on the publishable URL it will be a new authorization code.  
Do you have any ideas what could be causing the error I mentioned?  
Please let me know if there is an appropriate investigation method.

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [July 11, 2023, 5:37pm UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/6 "2023-07-11T17:37:13Z")

</div>

How often does this happen? While we do not have any specific mechanisms in place, the only things I can think of are

1. The authorization code that you are using in your request is incorrect or
2. It has been used before.

If this happens, then you should prompt your user to authorize the integration again.

---

<div class="post-metadata">

**Author:** ![zoom-app-public](https://avatars.discourse-cdn.com/v4/letter/z/d6d6ee/32.png) [@zoom-app-public](https://devforum.zoom.us/u/zoom-app-public)\
**Post date:** [July 12, 2023, 6:07am UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/7 "2023-07-12T06:07:00Z")

</div>

This only happened once.

Unless you intentionally modify the authorization code, this problem does not seem to occur.  
I don’t think it’s a big problem because it doesn’t occur continuously.

Thank you for your cooperation.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [July 14, 2024, 9:43pm UTC](https://devforum.zoom.us/t/getting-token-fails-due-to-invalid-authorization-code/91454/8 "2024-07-14T21:43:33Z")

</div>

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.
