0
votes

I am using passport-facebook to obtain an access token. According to here

https://developers.facebook.com/docs/marketing-apis#access-token

under "Get Access Token", I should be getting a 60 day long-lived token. This is the case if the scope is only ads_read. However, when I add additional scopes of manage_pages and read_insights, there is no expiration when I check via the Graph API.

This seems to be a bit contradictory to me. My theory is based on the getting an API key with ads_read permission manually from the below tool.

https://developers.facebook.com/apps//marketing-api/tools/

Using this tool and debugging it via the Graph API, I see one difference in that it the manually generated access token has the "Page" row under it, indicating that it is a page access token (to my own pages). Since it is a PAT, it will never expire, as expected.

My passport-facebook generated access token has the ads_read, manage_pages, read_insights permission as well and the expiration says "Never Expires". However, it does not have the Page row on it. Does that mean I can still use it forever to query the ads insights API?

This is my attempt at obtaining a non-expiring Marketing API access token.

1
System users have nonexpiring tokens developers.facebook.com/docs/marketing-api/businessmanager/…serg

1 Answers

1
votes

Yes, if the expiration row says Never expires, you can continue to use the token for querying ads insights.

On a side note, is you generate system user access tokens, they also never expire. You can read more about it here - https://developers.facebook.com/docs/marketing-api/businessmanager/systemuser/v2.8