guzzle / oauth-subscriber

Signs Guzzle requests using OAuth 1.0 (Guzzle 6+)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OAuth 1.0 Two-Legged

konshensx16 opened this issue · comments

Hello there,
The following is taken from the README file
You can set the auth request option to oauth for all requests sent by the client by extending the array you feed to new Client with auth => oauth.

use GuzzleHttp\Client;
use GuzzleHttp\HandlerStack;
use GuzzleHttp\Subscriber\Oauth\Oauth1;

$stack = HandlerStack::create();

$middleware = new Oauth1([
    'consumer_key'    => 'my_key',
    'consumer_secret' => 'my_secret',
    'token'           => 'my_token',
    'token_secret'    => 'my_token_secret'
]);
$stack->push($middleware);

$client = new Client([
    'base_uri' => 'https://api.twitter.com/1.1/',
    'handler' => $stack,
    'auth' => 'oauth'
]);

// Now you don't need to add the auth parameter
$res = $client->get('statuses/home_timeline.json');

Note

You can omit the token and token_secret options to use two-legged OAuth.

It says i can't ommit the token and token secret for two-legged aoth but whe i get rid of those two keys i get thr following exception:

Notice: Undefined index: token_secret in /homepages/42/d560140073/htdocs/oggo/guzzle/vendor/guzzlehttp/oauth-subscriber/src/Oauth1.php on line 243

My question is, does omitting means deleting them or keeping the keys but with an empty value ?

Thank you.

Hi there, the solution is apparently here: #68