# Intermittent 400 error when refreshing token "Save Access token into Database error"

**URL:** <https://devforum.zoom.us/t/intermittent-400-error-when-refreshing-token-save-access-token-into-database-error/63110>\
**Category:** API and Webhooks\
**Created:** [January 24, 2022, 5:37pm UTC](https://devforum.zoom.us/t/intermittent-400-error-when-refreshing-token-save-access-token-into-database-error/63110 "2022-01-24T17:37:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![basic](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/basic/32/31317_2.png) [@basic](https://devforum.zoom.us/u/basic)\
**Post date:** [January 24, 2022, 5:37pm UTC](https://devforum.zoom.us/t/intermittent-400-error-when-refreshing-token-save-access-token-into-database-error/63110/1 "2022-01-24T17:37:20Z")

</div>

**Description**  
Sometimes when we fetch a new access token, we get an error. This is a problem because access tokens only last 1 hour - so we need to fetch new tokens frequently.

We do use retries with exponential backoff, but sometimes we just can’t get a new token, despite retrying several times. This causes a lot of confusion for our customers, because Zoom appears to “not work” randomly for them, and then they blame our product.

I found this thread, but was hoping for more information or a way to stop these errors: [Occasional error when refreshing access / zak tokens - #6 by tommy](https://devforum.zoom.us/t/occasional-error-when-refreshing-access-zak-tokens/21377/6)

We already refresh the token “on user action” rather than in bulk. We only refresh the token when the currently stored token has already expired.

**Error**

```auto
400: 
{'reason': 'Invalid request : token created error: Save Access token into Database error', 'error': 'invalid_grant'}

```

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

**Which Endpoint/s?**  
[https://zoom.us/oauth/token](https://zoom.us/oauth/token)

**How To Reproduce (If applicable)**  
Not really applicable… we fetch a refresh token successfully using the same code hundreds of times per month.

---

<div class="post-metadata">

**Author:** ![donte.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/donte.zoom/32/24412_2.png) [@donte.zoom](https://devforum.zoom.us/u/donte.zoom)\
**Post date:** [January 26, 2022, 11:42am UTC](https://devforum.zoom.us/t/intermittent-400-error-when-refreshing-token-save-access-token-into-database-error/63110/2 "2022-01-26T11:42:16Z")

</div>

Greetings, @basic,

Thank you for posting in the Zoom Developer forum. Aside from the aforementioned suggestion, can you share details on the things you’ve already tried implementing to reduce the number of errors? There are many [best practice suggestions available on the internet](https://www.google.com/search?q=Best+practice+to+get+Oauth+refresh+access+token&oq=Best+practice+to+get+Oauth+refresh+access+token&aqs=chrome..69i57j69i64l3.788j0j7&sourceid=chrome&ie=UTF-8) but it’s ultimately your job to decide which solution is applicable to your situation. For instance, one approach you can consider is to set a scheduled job to refresh before the token expires. More details on this and alternative approaches can be found in this [How to Refresh Access token effectively](https://medium.com/@sumon.v0.0/okhttp-how-to-refresh-access-token-efficiently-6dece4d271c0) article.

I hope this helps,  
Donte

---

<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:** [February 25, 2022, 9:43pm UTC](https://devforum.zoom.us/t/intermittent-400-error-when-refreshing-token-save-access-token-into-database-error/63110/3 "2022-02-25T21:43:00Z")

</div>

Closed on February 25, 2022, 9:43pm UTC

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