protected function getToken()
    {
        /* @var ResponseInterface $response */
        $response = $this->post(self::TOKEN_URI, [
            'body' => [
                'grant_type' => 'authorization_code',
                'code' => $this->getCodeQueryField(),
                'client_id' => $this->clientId,
                'client_secret' => $this->clientSecret
            ]
        ]);

        if ($response->getStatusCode() == 200) {
            $this->setPropertiesBasedOnSuccessResponse($response->json());

            return;
        }

        $response = $response->json();
        throw new OAuthException("{$response['error']}:{$response['error_description']}");
    }
protected function getToken()
    {
        /* @var ResponseInterface $response */
        $response = $this->post(self::TOKEN_URI, [
            'body' => [
                'grant_type' => 'authorization_code',
                'code' => $this->getCodeQueryField(),
                'client_id' => $this->clientId,
                'client_secret' => $this->clientSecret
            ]
        ]);

        if ($response->getStatusCode() == 200) {
            $this->setPropertiesBasedOnSuccessResponse($response->json());

            return;
        }

        $response = $response->json();
        throw new OAuthException("{$response['error']}:{$response['error_description']}");
    }
protected function getToken ( ) { /* @var ResponseInterface $response */ $ response = $ this -> post ( self :: TOKEN_URI , [ 'body' => [ 'grant_type' => 'authorization_code' , 'code' => $ this -> getCodeQueryField ( ) , 'client_id' => $ this -> clientId , 'client_secret' => $ this -> clientSecret ] ] ) ; if ( $ response -> getStatusCode ( ) == 200 ) { $ this -> setPropertiesBasedOnSuccessResponse ( $ response -> json ( ) ) ; return ; } $ response = $ response -> json ( ) ; throw new OAuthException ( "{$response['error']}:{$response['error_description']}" ) ; }
Authorize - Second step

@throws ClientException e.g. on a Bad Request. The authorization code is only valid for 30 seconds.
@throws OAuthException
Authorize - Second step