codefog / contao-instagram

Contao extension that displays Instagram feed on your website
MIT License
11 stars 12 forks source link

Refresh instagram access token with cronjob #40

Closed falkgeist closed 4 weeks ago

falkgeist commented 1 year ago

At the moment, long-lived instagram tokens expire after 60 days, making it necessary to create a new token about every two months. This is tedious, tbh.

Is there a possiblity to add a cronjob to the bundle, that refreshes the token after e.g. 30 days via the corresponding endpoint of the Basic Display API?

Long lived access tokens

We already got several clients calling, asking why the feed is not showing posts anymore...

Thank you very much!

fritzmg commented 1 year ago

Is there a possiblity to add a cronjob to the bundle, that refreshes the token after e.g. 30 days via the corresponding endpoint of the Basic Display API?

Long lived access tokens

This requires a short lived access token which in turn requires a login. As far as I understand it, Facebook does not allow you to infinitely extend a long lived access token without authorization anymore.

If there is a way I would also be curious to know how it works :)

// edit, sorry, you meant the /refresh_access_token endpoint which exists for Instagram. That would work, yes.

falkgeist commented 1 year ago

Yes, exactly, GET /refresh_access_token, sorry, should have mentioned that. How difficult would it be for you to implement that?

falkgeist commented 1 year ago

I'm sorry to remind about this, I would create a PR, but I'm sure until I figure out how to implement the cronjob for the token refresh, you would've implemented it already in a third of that time.

fritzmg commented 1 year ago

If you cannot provide the PR yourself - and you are in need of this feature, then you should hire someone. Either the original creator of this extension or someone else.

falkgeist commented 1 year ago

Maybe @qzminski will see this, but I will try to find the time to fork this project and add the necessary cronjob 👍. I was under the impression you are more involved with this bundle, sorry, only checked your contributions now.

qzminski commented 1 year ago

I do see this and I will introduce it at some point, but I currently have no time to work on the open source projects.

qzminski commented 1 year ago

@falkgeist I have added it on the develop branch now. Can you try updating the extension to dev-develop@dev version?

Please note that it is now PHP 8.1 and Contao 4.13 LTS.

falkgeist commented 1 year ago

sorry for the late answer, I will test this once I find the time.

Although I might have to add support for 7.4 manually for the affected sites or test it in a dedicated Contao installation. (yes, I know, 7.4 is old news... 😉)