3
我使用下面的代碼發佈到用戶牆上yii2Yii2刷新Facebook的訪問令牌
$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授權客戶端類'或'臉書sdk',請任何想法。
使用Facebook \ FacebookSession; 使用Facebook \ FacebookRequest; 使用Facebook \ FacebookRequestException; 使用yii \ authclient \ clients \ Facebook; – 2015-02-07 14:59:51
你找到答案嗎? – 2015-06-13 10:34:40