I’m publishing to the Open Graph, I want my $facebook->api() calls to only use the app access token, but it tries to use the user access token, which works fine for a while, until their code expires.
I don’t want to be dealing with expired tokens so how can I set my code to just use the app token?
<?php
....
$accessToken = $facebook->getApplicationAccessToken();
$facebook->setAccessToken($accessToken);
$facebook->api();
?>
But getApplicationAccessToken() is protected so i can’t use it like that :/
The app access token doesn’t provide the same access as a user access token, they’re not directly interchangeable – the user access token is supposed to expire after 60 days (or 2 hours if you didn’t extend it)
If you need to use only the app access token for some reason, just modify the PHP SDK code to allow that use-case, the code is editable.