public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, $temporaryIdentifier, $verifier)
    {
        if ($temporaryIdentifier !== $temporaryCredentials->getIdentifier()) {
            throw new \InvalidArgumentException(
                'Temporary identifier passed back by server does not match that of stored temporary credentials.
                Potential man-in-the-middle.'
            );
        }

        $uri = $this->urlTokenCredentials();
        $bodyParameters = ['oauth_verifier' => $verifier];

        $client = $this->createHttpClient();

        $headers = $this->getHeaders($temporaryCredentials, 'POST', $uri, $bodyParameters);

        try {
            if ('GuzzleHttp\\Client' === get_class($client)) {
                $response = $client->post($uri, [
                    'headers'     => $headers,
                    'form_params' => $bodyParameters,
                ]);
            } else {
                $response = $client->post($uri, $headers, $bodyParameters)->send();
            }
        } catch (BadResponseException $e) {
            return $this->handleTokenCredentialsBadResponse($e);
        }

        return [
            'tokenCredentials'        => $this->createTokenCredentials($response->getBody()),
            'credentialsResponseBody' => $response->getBody(),
        ];
    }
public function getTokenCredentials(TemporaryCredentials $temporaryCredentials, $temporaryIdentifier, $verifier)
    {
        if ($temporaryIdentifier !== $temporaryCredentials->getIdentifier()) {
            throw new \InvalidArgumentException(
                'Temporary identifier passed back by server does not match that of stored temporary credentials.
                Potential man-in-the-middle.'
            );
        }

        $uri = $this->urlTokenCredentials();
        $bodyParameters = ['oauth_verifier' => $verifier];

        $client = $this->createHttpClient();

        $headers = $this->getHeaders($temporaryCredentials, 'POST', $uri, $bodyParameters);

        try {
            if ('GuzzleHttp\\Client' === get_class($client)) {
                $response = $client->post($uri, [
                    'headers'     => $headers,
                    'form_params' => $bodyParameters,
                ]);
            } else {
                $response = $client->post($uri, $headers, $bodyParameters)->send();
            }
        } catch (BadResponseException $e) {
            return $this->handleTokenCredentialsBadResponse($e);
        }

        return [
            'tokenCredentials'        => $this->createTokenCredentials($response->getBody()),
            'credentialsResponseBody' => $response->getBody(),
        ];
    }
public function getTokenCredentials ( TemporaryCredentials $ temporaryCredentials , $ temporaryIdentifier , $ verifier ) { if ( $ temporaryIdentifier !== $ temporaryCredentials -> getIdentifier ( ) ) { throw new \ InvalidArgumentException ( 'Temporary identifier passed back by server does not match that of stored temporary credentials.
                Potential man-in-the-middle.' ) ; } $ uri = $ this -> urlTokenCredentials ( ) ; $ bodyParameters = [ 'oauth_verifier' => $ verifier ] ; $ client = $ this -> createHttpClient ( ) ; $ headers = $ this -> getHeaders ( $ temporaryCredentials , 'POST' , $ uri , $ bodyParameters ) ; try { if ( 'GuzzleHttp\\Client' === get_class ( $ client ) ) { $ response = $ client -> post ( $ uri , [ 'headers' => $ headers , 'form_params' => $ bodyParameters , ] ) ; } else { $ response = $ client -> post ( $ uri , $ headers , $ bodyParameters ) -> send ( ) ; } } catch ( BadResponseException $ e ) { return $ this -> handleTokenCredentialsBadResponse ( $ e ) ; } return [ 'tokenCredentials' => $ this -> createTokenCredentials ( $ response -> getBody ( ) ) , 'credentialsResponseBody' => $ response -> getBody ( ) , ] ; }
Retrieves token credentials by passing in the temporary credentials,
the temporary credentials identifier as passed back by the server
and finally the verifier code.

@param \League\OAuth1\Client\Credentials\TemporaryCredentials $temporaryCredentials
@param string                                                 $temporaryIdentifier
@param string                                                 $verifier

@return \League\OAuth1\Client\Credentials\TokenCredentials
Retrieves token credentials by passing in the temporary credentials the temporary credentials identifier as passed back by the server and finally the verifier code .