private function pollDeviceAccessToken($deviceCode)
    {
        if (!$this->credentials instanceof DeviceCredentials) {
            throw new ClientError('Invalid credentials set up, must be of type ' . DeviceCredentials::class);
        }

        $this->credentials->deviceCode = $deviceCode;

        $params = [];
        $this->setParams($params, $this->credentials);

        try {
            $response = $this->post($params);
            return MapperUtil::mapResponse($response);
        } catch (Exception $e) {
            // check for auth pending case
            $err = $this->mapError($e, 'Error during device authentication.');
            if ($err instanceof AuthDeniedException && $err->getError() != null && $err->getError()->error ===
                'authorization_pending'
            ) {
                return false;
            }
            throw $err;
        } finally {
            // must reset to be ready for new auth attempt
            $this->credentials->deviceCode = null;
        }
    }