How to get a token for a long lifetime fb page?

How to get a token for a long lifetime fb page ?

Will I get it at this address?

The following node should help you with that. You “just” have to fill in your client ID and secret and a short-lived tocken which you can get from Graph API Explorer - Facebook for Developers.
It will then return a long-lived one as response.

1 Like

Thank you for scenario.

this is probably the code to obtain a long life token to access the website: GET “https://graph.facebook.com/{graph-api-version}/{user-id}/accounts?
access_token={long-lived-user-access-token}”

auto_awesome

Wyświetla tłumaczenie dla jak wygeneruje token dla użytkownika to wtedy powinien użyc tego kodu jeżeli dobrze rozumiem

Zamiast tego przetłumacz z jak wygeneruje token dla użytkownika to wtedy powinienen użyc tego kodu jeżeli dobrze rozumiem

if I will generate a token for the user then I should use this code if I understand correctly.

Unfortunately, however, something went wrong because it returned to me: data
[]

Did you change the values or leave them as the examples?

I changed the values. the first token was generated for me, but not the long-lived token for the fb website.

I changed the values. the first token was generated for me, but not the long-lived token for the fb website. on the contrary, I accidentally generated some long-lived user tokens

if I understand correctly this scenario allows you to get a Long-Lived User Access Token. However, to obtain a Long-Lived Page Access Token, it needs an additional module. I can create it based on this information.

curl -i -X GET “https://graph.facebook.com/{graph-api-version}/{user-id}/accounts?
access_token={long-lived-user-access-token}”

Your Module from the scenario creates a Long-Lived User Access Token. When I run the module that I added, the answer is: data
[]

What could be the reason for this? Despite obtaining a Long-Lived User Access Token, I cannot generate a Long-Lived Page Access Token?

Can we see the full output and whatever workflow you are running to generate it?

can it be?
the first element gets a long live user token while the second element should get the second long live page token.


Have you tried enabling full response to see if there is anything useful in the headers, That looks like Facebook is not sending all the data back which is odd.

Have you tried the same request with Postman to see what it comes back with?

“Have you tried enabling full response” where can it be turned on?

“Have you tried the same request with Postman to see what it comes back with?” no , I’ll do it soon

in the case of postman the result is the same {
“date”: []
}

what postman headers data do you need?

what postman headers data do you need?

Hey @Max_T,

If Postman is returning the same data then the issue is outside of n8n and could be something you are incorrectly sending or the endpoint is not correct.



Below, I am sending the permissions of the user token. In addition, I attach the address of the page from which I have the token.

read_insights
pages_manage_instant_articles
pages_show_list
ads_management
ads_read
business_management
pages_messaging
pages_messaging_phone_number
pages_messaging_subscriptions
attribution_read
pages_read_engagement
pages_manage_metadata
pages_read_user_content
pages_manage_posts
pages_manage_engagement
public_profile

If I want to create a long live page token, I must first have a long live user token. To create a long live user token, I need, among others, a user token. Can I download the necessary user token from this page: Graph API Explorer - Facebook for Developers

Hi @Max_T,

I have just done a bit of troubleshooting for you, If you use the Facebook Graph Explorer and tell it you want to get the data for /100075258373881/accounts do you see the same response and a warning?

I have tried using my ID and I get this…

The token generation is actually working the issue is with the user grants, To get this working I added pages_show_list to the list in Facebook.

I then took the Token and generated a new token in Postman and passed that to /v14.0/{user-id}/accounts and I am now getting the information back.

I can also use the same token in the Facebook Graph Explorer to get the information.

image

This same process is also working in n8n starting with the request Jan put together, Hopefully this helps you get up and running.