OAuth Access Token randomly expires

Hi,

I have my server verifying the Patreon membership status for all users that have it’s Patreon account connected.
The creator connects it’s Patreon Account and the server starts a background task to sync the tiers, it also runs this same sync when a change is sent through the Webhook

The server also refreshes the Access Token every 10 days to prevent the expiration of the token of the creator token. When this refresh happens both the new refresh and access tokens are stored replacing the old ones.

But I noticed that occasionally something fails returning me {"error": "invalid_grant"} this immediately makes the access token and refresh tokens unusable to another try

This last time I noticed that it matched the same time that a member of this forum complained about Patreon OAuth being unstable Patreon auth is unstable today

Is there a limit on how many times can I refresh the session (I say session because both access and refresh tokens differ after every refresh)?

There isnt such a limit for refreshes. There was a hiccup with the api that caused those issues a few days ago. If you are still frequently getting that error, let me know.