Open mikaelz opened 9 years ago
Yes, you are right
I have no idea how this code could work at any point.
so remove https://github.com/ashwinks/PHP-LinkedIn-SDK/blob/master/LinkedIn/LinkedIn.php#L240 as its not needed.
Remove everything after trim($endpoint, '/\\')
at https://github.com/ashwinks/PHP-LinkedIn-SDK/blob/master/LinkedIn/LinkedIn.php#L241
Finally on https://github.com/ashwinks/PHP-LinkedIn-SDK/blob/master/LinkedIn/LinkedIn.php#L243
replace $this->getAccessToken()
with $this->_access_token
.
For me fetch function looks like this and works:
public function fetch($endpoint, array $payload = array(), $method = 'GET', array $headers = array(), array $curl_options = array()) {
$endpoint = self::API_BASE . '/' . trim($endpoint, '/\\');
$headers[] = 'x-li-format: json';
$headers[] = 'Authorization: Bearer ' . $this->_access_token;
return $this->_makeRequest($endpoint, $payload, $method, $headers, $curl_options);
}
At https://github.com/ashwinks/PHP-LinkedIn-SDK/blob/master/LinkedIn/LinkedIn.php#L241 the method call has no param and so at https://github.com/ashwinks/PHP-LinkedIn-SDK/blob/master/LinkedIn/LinkedIn.php#L95 the $authorization_code never gets a value and so it can't function.