Problem to consume Linkedin API

Hello guys, good night!

I’m developing an app to consume the Linkedin API and use the basic information of users to our new system.

But there is one step who isn’t work at time…when I call this method and debug the
token …some errror message is exibited to me

   $params = [
            'grant_type' => $this->grantType,
            'client_id' => $this->clientID,
            'client_secret' => $this->clientSecret,
            'code' => $this->request->query['code'],
            'redirect_uri' => $this->callbackURL,
        ];
        

        $http = new Client();
        $response = $http->get('https://www.linkedin.com/uas/oauth2/accessToken', $params);
        $token = json_decode($response->body);
        
        debug($token);
                    
        $user_linkedin = $this->_fetchLinkedin('/v1/people/~:(firstName,lastName,emailAddress)', $token->access_token);

ERROR MESSAGE

\src\Controller\LoginLinkedinController.php (line 76)

object(stdClass) {
error_description => 'missing required parameters, includes an invalid parameter value, parameter more than once. : Unable to retrieve access token : appId or redirect uri does not match authorization code or authorization code expired’
error => ‘invalid_request’
}

According to https://developer.linkedin.com/docs/oauth2 section “Step 3 — Exchange Authorization Code for an Access Token”:

This is done by making the following “x-www-form-urlencoded” HTTP POST request:

POST https://www.linkedin.com/oauth/v2/accessToken

You should use $response = $http->post('https://www.linkedin.com/uas/oauth2/accessToken', $params);

Hello littleylv, thanks a lot for returning my question

Now, when I try to get the user information (firstName,lastName,emailAddress), the APP is returning other error message

THERE IS MY CODE

$http = new Client();
$response = $http->post(‘https://www.linkedin.com/uas/oauth2/accessToken’, $params);
$token = json_decode($response->body);

        $user_linkedin = $this->_fetchLinkedin('/v1/people/~:(firstName,lastName,emailAddress)', $token->access_token);
        
        debug($user_linkedin);

THERE IS AN ERROR PROMPT

\src\Controller\LoginLinkedinController.php (line 78)

object(stdClass) {
errorCode => (int) 0
message => 'Unknown authentication scheme’
requestId => '2PK898JSK5’
status => (int) 401
timestamp => (float) 1498251361191
}

I excpected when i debug this " debug($user_linkedin);" who user information were exhibited