Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
fokosun committed Oct 7, 2023
1 parent c97ea98 commit e5c6956
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions app/Http/Clients/TikTokHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
class TikTokHttpClient
{
protected array $config;
protected Client $client;

public function __construct()
public function __construct(Client $client)
{
$this->config = config('services.tiktok');
$this->client = $client;
}

public function getAccessToken(string $code)
{
$response = $this->getClient()->request(
$response = $this->client->request(
'POST',
$this->getUri() . '/oauth/access_token/',
[
Expand All @@ -41,7 +43,7 @@ public function getAccessToken(string $code)

public function getUserInfo(string $open_id, string $access_token)
{
$userInfoResponse = $this->getClient()->request('POST',
$userInfoResponse = $this->client->request('POST',
$this->getUri() . '/user/info/',
[
'json' => [
Expand Down Expand Up @@ -82,9 +84,4 @@ private function getClientSecret(): string
{
return $this->config['client_secret'] ?? '';
}

private function getClient()
{
return new Client();
}
}

0 comments on commit e5c6956

Please sign in to comment.