How to refresh Instagram token programmatically

I managed to get an Instagram app token and to extend it to 60 days. I saw it can be done via API.
I can’t manage to make it work in n8n. Authentication always fails.

Did someone manage to do it?

Hello,

Yes, I think it’s possibile try to use Graph API outside n8n to exchange your short-lived token for a 60-day one. Store this token in n8n using HTTP Request. Optionally build a workflow to refresh it using the refresh_access_token endpoint before expiry.

Let’s try and see if it’s worked

Thanks. Why outside of n8n? Cant’t it be done inside it?

I haven’t found a way to make this inside n8n yet.
Tell me if it works and fits for you.
If it does please mark the answer as solution

I’d love to have a solution within n8n

Instagram simply doesn’t allow it for security reasons. You have to manually refresh the tokens every 2 months.

And these social media APIs often change too (Like recent twitter/X api changes)

Best to use a service like Upload-Post - API for uploading videos to TikTok, Instagram, LinkedIn, Youtube & more

Thanks. Have you tried refreshing from within an n8n workflow?