SteelMan
SteelMan

Reputation: 3

Do I still need to use Facebook user access tokens to post to Facebook pages?

I've created and stored permanent facebook page access tokens. Must I still use a user access token each time I want to post to a fb page feed, or can I use only the page access token?

Here is command I'm using to setup the post now:

$page_post = (new FacebookRequest( **$session**, 'POST', '/'. $page_id .'/feed', array(
        'access_token' => $access_token,
        'name' => 'Randy Steel',
        'link' => 'http://www.LIPSapp.com/',
        'caption' => 'Example text',
        'message' => 'This is my link!',
) ));

Where $session holds the user access token and $access_token holds the permanent page access token.

If, because I have the perm page access token, I can skip getting/updating the user access token (60 days at best), how would the above command change? What would the value of $session need to be, or can that parameter be omitted?

Thanks in advance for any help.

Upvotes: 0

Views: 157

Answers (2)

andyrandy
andyrandy

Reputation: 74004

If you always want to post "as Page", you can use the stored Page Token - in fact, you HAVE to use the Page Token to post "as Page". You only need the User Token once, for getting an Extended Page Token.

I would not even use the PHP SDK for that, basic CURL calls are good enough. A small example of using CURL with the Facebook API can be found here: http://www.devils-heaven.com/extended-page-access-tokens-curl/

Upvotes: 0

Emre Aydin
Emre Aydin

Reputation: 552

With Facebook's new update like 2 years ago, pages acts like normal profile pages. So you only need access tokens of page not administrator's. Access tokens can be changed overtime or can be expired so it's best you to store administrators access token just in cas the access key losts its validity.

Upvotes: 1

Related Questions