protected function createLoginAttempt(array $data, array $headers, array $query)
    {
        // validate grant_type manually (needed to guess specialized option resolver)
        if (empty($data['grant_type'])) {
            throw new \InvalidArgumentException('Any grant_type given.');
        }
        $grantType = $data['grant_type'];
        if (!$this->grantExtensions->containsKey($grantType)) {
            throw new \InvalidArgumentException('Given grant_type is invalid.');
        }

        // create option resolver
        $requestResolver = new OptionsResolver();
        $requestResolver->setRequired(array(
            'client_secret',
            'client_api_key',
            'grant_type',
        ));
        $this->grantExtensions->get($grantType)
            ->configureRequestParameters($requestResolver)
        ;

        return new LoginAttempt(
            $query,
            $requestResolver->resolve($data),
            $headers
        );
    }