Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$authorization_code never gets set #20

Open
mikaelz opened this issue Aug 14, 2015 · 1 comment
Open

$authorization_code never gets set #20

mikaelz opened this issue Aug 14, 2015 · 1 comment

Comments

@mikaelz
Copy link

mikaelz commented Aug 14, 2015

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.

@minamoto19
Copy link

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants