Skip to content

Commit 071a56a

Browse files
committed
Updated oauth1 middleware
1 parent a735d4b commit 071a56a

File tree

3 files changed

+11
-81
lines changed

3 files changed

+11
-81
lines changed

composer.lock

+4-64
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ApiSettings.php

+6-14
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
use ApiClients\Foundation\Transport\Middleware\JsonDecodeMiddleware;
99
use ApiClients\Foundation\Transport\Options as TransportOptions;
1010
use ApiClients\Foundation\Transport\UserAgentStrategies;
11-
use JacobKiers\OAuth\Consumer\Consumer;
12-
use JacobKiers\OAuth\Token\Token;
11+
use ApiClients\Foundation\Oauth1\Options as Oauth1Options;
12+
use ApiClients\Tools\Psr7\Oauth1\Definition;
1313

1414
class ApiSettings
1515
{
@@ -37,24 +37,16 @@ public static function getOptions(
3737
): array {
3838
$options = self::TRANSPORT_OPTIONS;
3939
$options[Options::HYDRATOR_OPTIONS][HydratorOptions::NAMESPACE_SUFFIX] = $suffix;
40-
$options['auth'] = [
41-
'consumer' => [
42-
'key' => $consumerKey,
43-
'secret' => $consumerSecret,
44-
],
45-
'access_token' => [
46-
'token' => $accessToken,
47-
'secret' => $accessTokenSecret,
48-
],
49-
];
5040
$options[Options::TRANSPORT_OPTIONS][TransportOptions::MIDDLEWARE] = [
5141
Oauth1Middleware::class,
5242
JsonDecodeMiddleware::class,
5343
];
5444
$options[Options::TRANSPORT_OPTIONS][TransportOptions::DEFAULT_REQUEST_OPTIONS] = [
5545
Oauth1Middleware::class => [
56-
\ApiClients\Foundation\Oauth1\Options::CONSUMER => new Consumer($options['auth']['consumer']['key'], $options['auth']['consumer']['secret']),
57-
\ApiClients\Foundation\Oauth1\Options::TOKEN => new Token($options['auth']['access_token']['token'], $options['auth']['access_token']['secret']),
46+
Oauth1Options::CONSUMER_KEY => new Definition\ConsumerKey($consumerKey),
47+
Oauth1Options::CONSUMER_SECRET => new Definition\ConsumerSecret($consumerSecret),
48+
Oauth1Options::ACCESS_TOKEN => new Definition\AccessToken($accessToken),
49+
Oauth1Options::TOKEN_SECRET => new Definition\TokenSecret($accessTokenSecret),
5850
],
5951
];
6052
return $options;

src/AsyncClient.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class AsyncClient
2626
/**
2727
* @var Client
2828
*/
29-
protected $transport;
29+
protected $client;
3030

3131
public function __construct(
3232
string $consumerKey,
@@ -47,8 +47,6 @@ public function __construct(
4747
$client = Factory::create($loop, $this->options);
4848
}
4949
$this->client = $client;
50-
$this->consumer = new Consumer($consumerKey, $consumerSecret);
51-
$this->token = new Token($accessToken, $accessTokenSecret);
5250
}
5351

5452
public function user(string $user): PromiseInterface

0 commit comments

Comments
 (0)