first commit

This commit is contained in:
Ariyutta
2026-08-07 10:47:09 +07:00
commit 1c094fbe7f
11630 changed files with 1580900 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
namespace Laravel\Socialite\Two;
use GuzzleHttp\RequestOptions;
use Illuminate\Support\Arr;
class XProvider extends TwitterProvider
{
/**
* {@inheritdoc}
*/
public function getAuthUrl($state)
{
return $this->buildAuthUrlFromBase('https://x.com/i/oauth2/authorize', $state);
}
/**
* {@inheritdoc}
*/
protected function getTokenUrl()
{
return 'https://api.x.com/2/oauth2/token';
}
/**
* {@inheritdoc}
*/
protected function getUserByToken($token)
{
$response = $this->getHttpClient()->get('https://api.x.com/2/users/me', [
RequestOptions::HEADERS => ['Authorization' => 'Bearer '.$token],
RequestOptions::QUERY => ['user.fields' => 'profile_image_url,confirmed_email'],
]);
return Arr::get(json_decode($response->getBody(), true), 'data');
}
}