I need to show my company updates from Linkedin so I have created a Linkedin APP. I need to authenticate with OAuth2 in Linkedin with my app, not the user who visit my site.
I'm trying to get the acces token with curl, but I get always this error:
string(153) "{"error_description":"missing required parameters, includes an invalid parameter value, parameter more than once. : client_id","error":"invalid_request"}"
My code is:
$code = isset($_REQUEST['code'])?$_REQUEST['code']:"";
$curl_request = curl_init();
curl_setopt_array($curl_request, array(
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_URL => "https://www.linkedin.com/uas/oauth2/accessToken",
CURLOPT_POST => 1,
CURLOPT_HTTPHEADER => array('Content-Type: application/x-www-form-urlencoded'),
CURLOPT_POSTFIELDS => array(
grant_type => "authorization_code",
code => $code,
redirect_uri => LINKEDIN_CALLBACK_URL,
client_id => LINKEDIN_API_KEY,
client_secret => LINKEDIN_API_SECRETE_KEY
)
));
$curl_result = curl_exec($curl_request);
var_dump($curl_result);