Updates
This commit is contained in:
19
vendor/laravel/socialite/readme.md
vendored
19
vendor/laravel/socialite/readme.md
vendored
@@ -13,8 +13,6 @@ Laravel Socialite provides an expressive, fluent interface to OAuth authenticati
|
||||
|
||||
**We are not accepting new adapters.**
|
||||
|
||||
Adapters for other platforms are listed at the community driven [Socialite Providers](https://socialiteproviders.github.io/) website.
|
||||
|
||||
## License
|
||||
|
||||
Laravel Socialite is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
|
||||
@@ -113,15 +111,6 @@ return Socialite::driver('google')
|
||||
|
||||
When using the `with` method, be careful not to pass any reserved keywords such as `state` or `response_type`.
|
||||
|
||||
#### Stateless Authentication
|
||||
|
||||
The `stateless` method may be used to disable session state verification. This is useful when adding social authentication to an API:
|
||||
|
||||
```php
|
||||
return Socialite::driver('google')->stateless()->user();
|
||||
```
|
||||
|
||||
|
||||
#### Retrieving User Details
|
||||
|
||||
Once you have a user instance, you can grab a few more details about the user:
|
||||
@@ -145,11 +134,3 @@ $user->getName();
|
||||
$user->getEmail();
|
||||
$user->getAvatar();
|
||||
```
|
||||
|
||||
#### Retrieving User Details From Token
|
||||
|
||||
If you already have a valid access token for a user, you can retrieve their details using the `userFromToken` method:
|
||||
|
||||
```php
|
||||
$user = Socialite::driver('github')->userFromToken($token);
|
||||
```
|
||||
|
@@ -4,7 +4,6 @@ namespace Laravel\Socialite\One;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use InvalidArgumentException;
|
||||
use League\OAuth1\Client\Credentials\TokenCredentials;
|
||||
use League\OAuth1\Client\Server\Server;
|
||||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Laravel\Socialite\Contracts\Provider as ProviderContract;
|
||||
@@ -75,31 +74,6 @@ abstract class AbstractProvider implements ProviderContract
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a Social User instance from a known access token and secret.
|
||||
*
|
||||
* @param string $token
|
||||
* @param string $secret
|
||||
* @return \Laravel\Socialite\One\User
|
||||
*/
|
||||
public function userFromTokenAndSecret($token, $secret)
|
||||
{
|
||||
$tokenCredentials = new TokenCredentials();
|
||||
|
||||
$tokenCredentials->setIdentifier($token);
|
||||
$tokenCredentials->setSecret($secret);
|
||||
|
||||
$user = $this->server->getUserDetails($tokenCredentials);
|
||||
|
||||
$instance = (new User)->setRaw($user->extra)
|
||||
->setToken($tokenCredentials->getIdentifier(), $tokenCredentials->getSecret());
|
||||
|
||||
return $instance->map([
|
||||
'id' => $user->uid, 'nickname' => $user->nickname,
|
||||
'name' => $user->name, 'email' => $user->email, 'avatar' => $user->imageUrl,
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the token credentials for the request.
|
||||
*
|
||||
|
@@ -140,7 +140,7 @@ abstract class AbstractProvider implements ProviderContract
|
||||
$state = null;
|
||||
|
||||
if ($this->usesState()) {
|
||||
$this->request->session()->set('state', $state = $this->getState());
|
||||
$this->request->session()->set('state', $state = Str::random(40));
|
||||
}
|
||||
|
||||
return new RedirectResponse($this->getAuthUrl($state));
|
||||
@@ -168,7 +168,7 @@ abstract class AbstractProvider implements ProviderContract
|
||||
{
|
||||
$fields = [
|
||||
'client_id' => $this->clientId, 'redirect_uri' => $this->redirectUrl,
|
||||
'scope' => $this->formatScopes($this->getScopes(), $this->scopeSeparator),
|
||||
'scope' => $this->formatScopes($this->scopes, $this->scopeSeparator),
|
||||
'response_type' => 'code',
|
||||
];
|
||||
|
||||
@@ -234,8 +234,10 @@ abstract class AbstractProvider implements ProviderContract
|
||||
if ($this->isStateless()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$state = $this->request->session()->pull('state');
|
||||
//dd($this->request->all());
|
||||
$state = $this->request->input('state');
|
||||
\Session::put('state', $state);
|
||||
//$state = $this->request->session()->pull('state');
|
||||
|
||||
return ! (strlen($state) > 0 && $this->request->input('state') === $state);
|
||||
}
|
||||
@@ -390,16 +392,6 @@ abstract class AbstractProvider implements ProviderContract
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the string used for session state.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function getState()
|
||||
{
|
||||
return Str::random(40);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the custom parameters of the request.
|
||||
*
|
||||
|
@@ -19,14 +19,14 @@ class FacebookProvider extends AbstractProvider implements ProviderInterface
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $version = 'v2.8';
|
||||
protected $version = 'v2.6';
|
||||
|
||||
/**
|
||||
* The user fields being requested.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fields = ['name', 'email', 'gender', 'verified', 'link'];
|
||||
protected $fields = ['name', 'email', 'gender', 'verified'];
|
||||
|
||||
/**
|
||||
* The scopes being requested.
|
||||
@@ -116,7 +116,6 @@ class FacebookProvider extends AbstractProvider implements ProviderInterface
|
||||
'id' => $user['id'], 'nickname' => null, 'name' => isset($user['name']) ? $user['name'] : null,
|
||||
'email' => isset($user['email']) ? $user['email'] : null, 'avatar' => $avatarUrl.'?type=normal',
|
||||
'avatar_original' => $avatarUrl.'?width=1920',
|
||||
'profileUrl' => isset($user['link']) ? $user['link'] : null,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -171,7 +170,5 @@ class FacebookProvider extends AbstractProvider implements ProviderInterface
|
||||
public function reRequest()
|
||||
{
|
||||
$this->reRequest = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -79,7 +79,6 @@ class GoogleProvider extends AbstractProvider implements ProviderInterface
|
||||
return (new User)->setRaw($user)->map([
|
||||
'id' => $user['id'], 'nickname' => Arr::get($user, 'nickname'), 'name' => $user['displayName'],
|
||||
'email' => $user['emails'][0]['value'], 'avatar' => Arr::get($user, 'image')['url'],
|
||||
'avatar_original' => preg_replace('/\?sz=([0-9]+)/', '', Arr::get($user, 'image')['url']),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
@@ -12,7 +12,7 @@ class LinkedInProvider extends AbstractProvider implements ProviderInterface
|
||||
* @var array
|
||||
*/
|
||||
protected $scopes = ['r_basicprofile', 'r_emailaddress'];
|
||||
|
||||
|
||||
/**
|
||||
* The separating character for the requested scopes.
|
||||
*
|
||||
|
Reference in New Issue
Block a user