I have a dashboard where users click a button and is redirected to Facebook where they allow me to access ad reports. It works. I get an access token and make another request to get the long access token which expires every 60 days.
I was mistakenly under the impression that as long as the access token was not expired e.g. 3 days prior to expiration, I would be able to extend for another 60 days. No such luck. I try and get a new long-lived access token the expiration is the same.
How do I get a token where my users do not have to reauth every 60 days? I cant find the docs.
This post claims to be able to get a permanent access token but I don't know how to modify it for a client.
import facebook
graph = facebook.GraphAPI(access_token=user_long_token, version="3.0")
pages_data = graph.get_object("/me/accounts")
permanent_page_token = pages_data["data"][0]["access_token"]
page_id = pages_data["data"][0]["id"]
DO I modify /me/accounts? If so how for a client? I can pass the user_long_token but the response I get is:
print(pages_data)
{'data': []}
I assume I have to replace /me/accounts with something else. All I have in an account id, an access token, and long access token.
Utterly confused. Thanks