SocialiteProviders\Manager\OAuth1\Server::getTokenCredentials PHP Method

getTokenCredentials() public method

Retrieves token credentials by passing in the temporary credentials, the temporary credentials identifier as passed back by the server and finally the verifier code.
public getTokenCredentials ( League\OAuth1\Client\Credentials\TemporaryCredentials $temporaryCredentials, string $temporaryIdentifier, string $verifier ) : League\OAuth1\Client\Credentials\TokenCredentials
$temporaryCredentials League\OAuth1\Client\Credentials\TemporaryCredentials
$temporaryIdentifier string
$verifier string
return League\OAuth1\Client\Credentials\TokenCredentials
    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 (get_class($client) == 'GuzzleHttp\\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()];
    }