6

I have been trying to find a way to create a never expiring FaceBook Page Access Token. I have seen the option where you provide the AppID|AppSecret in place of the token however that requires you to submit the app for approval and facebook does not seem to understand concept of OTHER apps using the token. Regardless, see the answer below for how I found a way to do this.

George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52
  • so...what is your question? stackoverflow is not a blog platform, it´s for questions. btw, there are no never expiring page tokens anymore afaik. even your screenshot tells you that it does in fact expire. – andyrandy Nov 28 '18 at 08:12
  • 1
    So I reworded this to make you happy. Also, according to the actual Facebook Access Token tool, you are incorrect regarding not being able to get a never expiring token. Please see number 9 in my answer - which I do not have a screen shot of. "In the Access Token Debugger that will open up, click on the 'Extend Access Token' button at the bottom of the page. A new access token should be displayed and the text above it should say that it never expires" – George M Ceaser Jr Nov 28 '18 at 14:42
  • you may want to read this, it´s pretty new: https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension – andyrandy Nov 29 '18 at 12:33
  • That is about short lived versus long lived tokens, not never expiring. – George M Ceaser Jr Dec 08 '18 at 21:56
  • yes it is. extended page tokens were never expiring earlier, but they are not anymore. – andyrandy Dec 09 '18 at 16:17
  • No that is not what this post is about - it is about a page access token that never expires. Please see the screen shot I posted down below from the Facebook Access Token tool that shows that my token, generated using this method never expires. – George M Ceaser Jr Dec 10 '18 at 20:01
  • this may as well be a bug right now, as they changed it recently. did you try using the token for more than 60 days without refreshing? – andyrandy Dec 10 '18 at 23:03
  • I can't really speak to whether or not there is a bug in a FaceBook product. All I can say is it is working onw and will continue to test through the 60 day point. I will update the post after the 60 days to see if it expires or not. – George M Ceaser Jr Dec 12 '18 at 22:08
  • 2
    This is a legitimate developer question for a real world problem. There are companies that want to extract their page insights data to load into a data warehouse using a scheduled script and a non-expiring token. There are some published workarounds to this question like https://www.rocketmarketinginc.com/blog/get-never-expiring-facebook-page-access-token/#updated2018 and https://medium.com/@Jenananthan/how-to-create-non-expiry-facebook-page-token-6505c642d0b1 Being pedantic about whether these workarounds are a bug is not constructive. – Braintapper Jan 23 '19 at 16:43
  • 2
    Just an FYI - it is coming up on three months since I created this token and it is still working. I will actively watch and test it after the 90 days have expired to see if it truly is a non-expiring token. – George M Ceaser Jr Feb 21 '19 at 19:37
  • @luschn did it expire in 60 days? – Daniele B Jun 17 '19 at 19:00

1 Answers1

17

After piecing together many different solutions - I did this and it seems to work. I assume you only want a token for a single page and that you already have your Facebook app page setup.

  1. Get the ID of the page by navigating to it from a web browser, click on About link in the menu list down the left hand side of the page, then scroll to the bottom of the About information and you will see the Page ID display.

  2. Navigate to Facebook Graph API Explorer

  3. Remove everything after the API Version (in this case v3.2) on this line of the explorer
    enter image description here

and replace it with 123456789?fields=access_token where 123456789 is your page ID.

enter image description here

  1. Click the Submit button to the right hand side of the line you just entered the text into.

    1. You will receive a token back in the response at the bottom of the screen that looks similar to this:

{ "access_token": "TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT", "id": "1755746091324056" } where TTTTTTTT is your access token.

  1. Copy the token only (no quotes) out of the response and past it in the Access Token field at the top of the Page replacing the Access Token that was previously there.

enter image description here

  1. After pasting in the new access token click on the blue information icon to the left of the access token.

  2. In the Access Token Information dialog, click on the 'Open in Access Token Tool' button at the bottom right of the dialog.

enter image description here

  1. In the Access Token Debugger that will open up, click on the 'Extend Access Token' button at the bottom of the page. A new access token should be displayed and the text above it should say that it never expires.

enter image description here

I hope this helps.

PS - Here is what I see in Facebook's Access Token tool when I paste the token generated using this method into it. It says this token will never expire.

enter image description here

George M Ceaser Jr
  • 1,497
  • 3
  • 23
  • 52
  • 1
    Do you need to be page owner? Or page admin is enough? – Tom Raganowicz Feb 02 '19 at 14:12
  • NeverEndingQueue Not Sure -- I am both for my page. – George M Ceaser Jr Feb 02 '19 at 19:13
  • 1
    Facebook says that your app needs to have business permission ... which is a requirements I am not sure to understand at the app level. The tokens I am generating are only valid for two months doing this. – AsTeR Feb 27 '19 at 20:08
  • AsTeR, If you ensure you have the same scopes on the page as I show above and follow the steps I have outlined, you should be good to go. It has been over five months since I generated my token and it is still working fine. – George M Ceaser Jr May 18 '19 at 20:01
  • 6
    I have done all this, but it says that it expires in 2 months! @AsTeR did you find a solution? – Daniele B Jun 17 '19 at 18:54
  • @DanieleB no, but without being sure, it seems that the token is not actually expiring – AsTeR Jun 18 '19 at 13:22
  • Daniele B - The two month token is the first token. It looks like maybe you only did to step 5. Try starting at step 6 using the page access token that expires in two month. Also remember this does not work for all types of Access tokens, only facebook app page access token. – George M Ceaser Jr Jun 18 '19 at 17:48
  • @GeorgeMCeaserJr actually I completely all steps – Daniele B Jun 19 '19 at 14:14
  • Daniele B -- so in step 8 when you viewed the access token information, what expiration does it show? and you are using the access token that was generated in the last step when you clicked the "Extend Access Token" button correct? – George M Ceaser Jr Jun 19 '19 at 18:08
  • Step 8 shows the normal token expiration -- like an hour I think? Yes using the access token that is in the last step when you click the extend token. When I copied that token, and past it back into FaceBook's access token tool, I see the last screen shot which show that token never expires. – George M Ceaser Jr Jun 25 '19 at 17:33
  • Just tried this and it only extends it for 2 months. – TulsaNewbie Aug 14 '19 at 03:02
  • This will only work for pages. Are you shure you are using a page access token and not user or some other type? – George M Ceaser Jr Aug 15 '19 at 16:56
  • 2
    This seems to no longer be working. For some reason facebook revoked all of my login sessions which also invalidated my "never expiring" token. I tried making a new one but I keep getting the 2 month cap. – Chad Cache Oct 20 '19 at 06:24
  • Chad, Mine is still working. Not sure why facebook would revoke all your login sessions. – George M Ceaser Jr Oct 22 '19 at 14:48
  • @GeorgeMCeaserJr Have you tried generating a new one recently? – Chad Cache Oct 27 '19 at 10:46
  • @ChadScira No I have not. Mine is still working and I only have one app page. – George M Ceaser Jr Oct 28 '19 at 13:41
  • Any updates on this? I have one never expiring token but trying to get a token for a different app seems to fail (limited to 3 months). – p0rter Dec 09 '19 at 13:05
  • So first remember this only works for FaceBook app pages and app page tokens. I only have one such page currently so I have not been able to try it again. In the next few weeks I will be creating a second page for a new app and will try test it out again there. – George M Ceaser Jr Dec 10 '19 at 14:29
  • 3
    I'm also only able to extend a token to 3 months, and no further. – Orun Jan 15 '21 at 22:33
  • How to automate this? – Volatil3 Jul 05 '21 at 06:26
  • @GeorgeMCeaserJr In your answer, you mentioned a single page, how to do it for multiple pages? Any help really appriciated. Thanks. – zus Jul 06 '21 at 16:47
  • 3
    These steps don't seem to work anymore however I had success by following the instructions on this page https://medium.com/@blienart/get-a-permanent-facebook-page-access-token-a96470dc03ca – Visualise Jul 07 '21 at 05:56