我正在使用下一代码在yii2
中发布到用户墙 $client = Yii::$app->get('authClientCollection')->getClient('facebook');
$access_token = new Facebook();
$access_token->clientId = $client->clientId;
$access_token->clientSecret = $client->clientSecret;
$session = new FacebookSession($access_token->accessToken);
if ($session) {
try {
$response = (new FacebookRequest(
$session, 'POST', '/me/feed', array(
'link' => 'test link',
'message' => 'message here'
)
))->execute()->getGraphObject();
echo "Posted with id: " . $response->getProperty('id');
} catch (FacebookRequestException $e) {
echo "Exception occured, code: " . $e->getCode();
echo " with message: " . $e->getMessage();
}
}
但是我遇到的问题是我没有找到任何方法来扩展访问令牌并使用' yii2 auth客户端类'来刷新它。或者' facebook sdk' ,任何想法,请。