Hello,
I’m currently building an automation to post pictures on several social networks when a card on Trello is due.
Everything works fine so far, except the authorization with the Facebook Graph API, which I need for Facebook and Instagram posts.
I have to manually create the token here.
The long-lived token is only valid for 2-3 months though, which makes it a bit annoying to re-new it every few months.
Is there any way I can automate the token-generating with n8n, so that it automatically creates a token when executing my workflow? Similar to how someone would authorize themselves with Facebook when creating an account somewhere.
Hi @tomato_planet, I am not aware of a way to automate the renewal of your personal token I am afraid.
However, in many cases this shouldn’t be required. Are you using your token to post on a FB page by any chance? If so, you can first send a request to me/accounts like so:
This returns a page-specific token for each page I have access to for me:
Hi, thanks for your help! I am actually posting to a Facebook page and with your method I was able to get that new token for it.
The only thing that concerned me was the data access expiration listed underneath the token expiration, but apparently most permissions won’t expire, or the data access will automatically re-new itself. Facebook’s documentation about that is not too detailed. I’ll see what happens in a few months!
I’m also interested in this but I can also see that the page access tokens expires too. if you use the debugger tool it says that it never expires but the “data access expires” says 3 months. So does this mean that every 3 months I’ll have to remind myself to re-authenticate?
I’m also looking for a way to automate the token renewal. The page access token returned from calling /me/accounts works though and using the token debugger I was able to extend the token’s validity to about two months. Which is workable for my use-case, but would be nicer if I don’t have to worry about this anymore…