Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

HTTP client options not honoured when calling getAccessToken #21

Description

@SteveTalbot

When a Twitter object is first instantiated, an HTTP client is created, using the http_client_options specified in the array passed into the constructor. So for example, if you want to use curl as your HTTP adapter, you can do something like this:

$config = array(
    'oauth_options' => array(
        'consumerKey' => 'twitter-consumer-key-here',
        'consumerSecret' => 'twitter-consumer-secret-here',
    ),
    'http_client_options' => array(
        'adapter' => 'Zend\Http\Client\Adapter\Curl',
        'curloptions' => array(
             CURLOPT_CAINFO => 'path-to-ca-cert-here',
        )
    ),
);
$twitter = new Twitter($config);

When getAccessToken() is called, the HTTP client is replaced and the http_client_options are not honoured. This means the default stream adapter will be used instead of curl.

The problem seems to be on line 219 of ZendService\Twitter\Twitter.php, but I've been trying for ages and can't find an elegant solution:

$this->setHttpClient($return->getHttpClient($this->options));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions