Skip to content

Commit

Permalink
Enforce the use of RequestOptions (#1075)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasmichot authored Aug 31, 2023
1 parent 7da5af3 commit 98d7aa6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SocialiteProviders\TikTok;

use GuzzleHttp\RequestOptions;
use Illuminate\Support\Arr;
use Laravel\Socialite\Two\InvalidStateException;
use SocialiteProviders\Manager\OAuth2\AbstractProvider;
Expand Down Expand Up @@ -97,14 +98,14 @@ protected function getTokenFields($code)
*/
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get(
'https://open.tiktokapis.com/v2/user/info/?fields=open_id,union_id,display_name,avatar_large_url',
[
'headers' => [
'Authorization' => 'Bearer '.$token,
],
]
);
$response = $this->getHttpClient()->get('https://open.tiktokapis.com/v2/user/info/', [
RequestOptions::HEADERS => [
'Authorization' => 'Bearer '.$token,
],
RequestOptions::QUERY => [
'fields' => 'open_id,union_id,display_name,avatar_large_url',
],
]);

return json_decode((string) $response->getBody(), true);
}
Expand Down

0 comments on commit 98d7aa6

Please sign in to comment.