Server IP : 66.29.132.124 / Your IP : 3.142.135.24 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/vendor/laravel/socialite/src/Two/ |
Upload File : |
<?php namespace Laravel\Socialite\Two; use Illuminate\Support\Arr; class TwitterProvider extends AbstractProvider { /** * The scopes being requested. * * @var array */ protected $scopes = ['users.read', 'tweet.read']; /** * Indicates if PKCE should be used. * * @var bool */ protected $usesPKCE = true; /** * The separating character for the requested scopes. * * @var string */ protected $scopeSeparator = ' '; /** * {@inheritdoc} */ public function getAuthUrl($state) { return $this->buildAuthUrlFromBase('https://twitter.com/i/oauth2/authorize', $state); } /** * {@inheritdoc} */ protected function getTokenUrl() { return 'https://api.twitter.com/2/oauth2/token'; } /** * {@inheritdoc} */ protected function getUserByToken($token) { $response = $this->getHttpClient()->get('https://api.twitter.com/2/users/me', [ 'headers' => ['Authorization' => 'Bearer '.$token], 'query' => ['user.fields' => 'profile_image_url'], ]); return Arr::get(json_decode($response->getBody(), true), 'data'); } /** * {@inheritdoc} */ protected function mapUserToObject(array $user) { return (new User)->setRaw($user)->map([ 'id' => $user['id'], 'nickname' => $user['username'], 'name' => $user['name'], 'avatar' => $user['profile_image_url'], ]); } /** * {@inheritdoc} */ public function getAccessTokenResponse($code) { $response = $this->getHttpClient()->post($this->getTokenUrl(), [ 'headers' => ['Accept' => 'application/json'], 'auth' => [$this->clientId, $this->clientSecret], 'form_params' => $this->getTokenFields($code), ]); return json_decode($response->getBody(), true); } }