Creator's Access Token refreshes all the time

Hello,
I’ve been developing a Patreon integration for my website on localhost for quite some time, and let’s say it worked fine. I have Creator Access Token hardcoded.
Now I am testing everything on my webserver, and it seems that CAT is refreshed at least every few hours. I tried to create a new client, but it didn’t help. Am I doing something wrong? Is it possible to get CAT from API using patreon-php with CID and Secret?

Patreon’s API is so retarded that it drives me nuts…

You shouldnt hardcode the token in a way that is not possible to update it. The token may get refreshed. It definitely shouldnt be a few hours - there may be something in your app or a library which you are using that causes the refresh maybe.

Of course, it is easy to change in the code, but just pain. I’m automating everyting that can be automated; this script is executed by cron, so I would have to check all the time if my CAT hasn’t changed so that it runs properly.
As I said previously, I am using https://github.com/Patreon/patreon-php so I don’t think it causes the refreshing.

No such frequent refreshing issue with the PHP lib was reported. PHP lib does not automate getting and refreshing tokens anyway - the token must have been already acquired.

WordPress plugin has internal logic which allows creation of apps, and checking and refreshing expiring tokens automatically. Both for creator access token and user’s app tokens. You can check its logic to get ideas about how to implement such automation.

1 Like

For now it seems that it hasn’t refreshed since yesterday evening. If the weird behavior comes back though, I will have a look into that wordpress plugin. Thanks.

1 Like

Just some sharing from my own debugging of patreon-php.
Access and refresh tokens are updated every time you make the refresh_token function call with the creator’s access token.
If it updates so frequently for you, then it maybe triggered every time by some logic flow from your users.
I knew it happened for me so I made amendments to my user flow.

1 Like