Rahul Mahadev
Rahul Mahadev

Reputation: 67

Facebook PHP 4.0 - Generate access token based on username and password

I'm building a facebook connector for a CMS,And the task of my module is to post all the posts on the website to Facebook.As I won't be able to redirect to Facebook login helper and there is typically only one user,Is it possible to generate access token based on username and password.

FacebookSession::setDefaultApplication( $this->settings['facebook']['appid'],$this->settings['facebook']['secret'] );
    $session = new FacebookSession($this->settings['facebook']['token']);

this is the current setup,I have to manually get an access token every hour or so,is there any other alternative?

Upvotes: 0

Views: 382

Answers (1)

Fosco
Fosco

Reputation: 38516

Have you tried extending the session?

$newSession = $session->getLongLivedSession();
$newToken = $newSession->getToken();

Upvotes: 2

Related Questions