Igor Kromin |   Consultant. Coder. Blogger. Tinkerer. Gamer.

Quite some time ago I wrote a couple of articles about Integrating with Facebook using PHP and pre-authenticated tokens (and part 2). Then I mostly forgot about access tokens, expiration dates and the such...until I tried to share a post from my blog and got the following error...
 Error
(#200) If posting to a group, requires app being installed in the group, and \ either publish_to_groups permission with user token, or both manage_pages \ and publish_pages permission with page token; If posting to a page, \ requires both manage_pages and publish_pages as an admin with \ sufficient administrative permission


Aside - I knew that Facebook has been changing how they assign permissions to apps and the whole application approval process has been changing, so I wasn't keen to have to go through that. Luckily though, if you application is in 'development' mode, you don't need to have it approved and can make use of all the permissions. This is exactly what I do since my 'app' is only there so I can post directly to Facebook from my blog.

Ok so I thought I just needed to extend my long life access token (as described in my earlier blog posts linked above), but when doing that, the following error came up...
 Error
Error validating access token: Session has expired on Sunday, 24-Jun-18 06:00:00 PDT. The current time is Wednesday, 23-Sep-20 16:33:46 PDT.


I made sure that the token was actually expired using Facebook's Access Token Debugger tool, and yep it really did expire for data access...two weeks ago.
fbtok_1.png




So I needed to generate a new user token then. For that I used the Graph API Explorer, selecting the permissions I needed from the error message at the top of this post.
fbtok_2.png


Just to be sure, I checked that the access token was valid...
fbtok_3.png


Now I could replace my existing user token in my Blog's configuration and get the extended token in its place. Everything worked as expected again!

-I

A quick disclaimer...

Although I put in a great effort into researching all the topics I cover, mistakes can happen. Use of any information from my blog posts should be at own risk and I do not hold any liability towards any information misuse or damages caused by following any of my posts.

All content and opinions expressed on this Blog are my own and do not represent the opinions of my employer (Oracle). Use of any information contained in this blog post/article is subject to this disclaimer.
Hi! You can search my blog here ⤵
NOTE: (2022) This Blog is no longer maintained and I will not be answering any emails or comments.

I am now focusing on Atari Gamer.