Saturday, August 15, 2015

Guzzle 6 OAuth Issue for twitter authentication

There are is a major change has been made in Guzzle 6 and for this architecture changes in 6.0 have now broken most available OAuth plugin packages, including their own oauth-subscriber that hasn’t seen a new version since 5.* fixes in October 2014.

YAML configs must also be changed to handle the new middleware architecture.

Note for user-defined parameters, base_url has become base_uri to match changes to the Client constructor’s named arguments. To define this argument, 6.0 uses UriInterface which I believe doesn’t support placeholders so I’ve just placed the Twitter version directly in the base_uriconfiguration string.


// composer.json
{
    "require": {
        "guzzlehttp/guzzle": "~6.0",
        "guzzlehttp/oauth-subscriber": "dev-master"
    },
}


Changes from 5.*

Middleware HandlerStack::create() must be used for the OAuth1 instance and passed into the Client constructor.

Guzzle 5.* 

There were no major architectural changes in this version so you can keep the above configuration. However you must upgrade oauth-subscriber to 0.2.0 since 0.1.* is only compatible with 4.0.

// composer.json
{
    "require": {
        "guzzlehttp/guzzle": "^5.0",
        "guzzlehttp/oauth-subscriber": "0.2.*"
    },
}


To know more about the service/repository got to the following link

https://github.com/guzzle/oauth-subscriber

No comments:

Post a Comment