1
出於安全原因,我決定在我的Facebook應用上啓用「需要應用祕密」。然後我發現Laravel Socialite版本「^2.0
」沒有工作,因爲它沒有發送類「Laravel\Socialite\Two\FacebookProvider
」的方法「getUserByToken
」的appsecret_proof。當Facebook應用「需要應用祕密」設置啓用時,Laravel Socialite不起作用
我決定速戰速決:
/**
* {@inheritdoc}
*/
protected function getUserByToken($token)
{
$appsecret_proof= hash_hmac('sha256', $token, $this->clientSecret);//THIS IS MY QUICK FIX
$response = $this->getHttpClient()->get($this->graphUrl.'/'.$this->version.'/me?access_token='.$token.'&appsecret_proof='.$appsecret_proof.'&fields='.implode(',', $this->fields), [
'headers' => [
'Accept' => 'application/json',
],
]);
return json_decode($response->getBody(), true);
}
是否有此要求更好的解決方案?這個用例是否有官方補丁?
謝謝