A package for Laravel Socialite that allows you to easily add new providers or override current providers.
stateless()
can be set to true
or false
.env
file instead of also having to configure the services array.Below is an example handler. You need to add this full class name to the listen[]
in the EventServiceProvider
.
providername
is the name of the provider such as meetup
.namespace Your\Name\Space;
use SocialiteProviders\Manager\SocialiteWasCalled;
class ProviderNameExtendSocialite
{
public function handle(SocialiteWasCalled $socialiteWasCalled)
{
$socialiteWasCalled->extendSocialite('providername', \Your\Name\Space\Provider::class);
}
}
You can easily override a built-in laravel/socialite
provider by creating a new one with exactly the same name (i.e. 'facebook').
You can dynamically pass a config by using:
$clientId = "secret";
$clientSecret = "secret";
$redirectUrl = "http://yourdomain.com/api/redirect";
$additionalProviderConfig = ['site' => 'meta.stackoverflow.com'];
$config = new \SocialiteProviders\Manager\Config($clientId, $clientSecret, $redirectUrl, $additionalProviderConfig);
return Socialite::with('provider-name')->setConfig($config)->redirect();
You must call this before you run any Socialite methods.
Take a look at the other OAuth1 providers for inspiration.
Laravel Socialite by default only allows access to the access_token
. Which can be accessed
via the \Laravel\Socialite\User->token
public property. Sometimes you need access to the whole response body which
may contain items such as a refresh_token
.
To make this possible, the OAuth2 provider class needs to extend \SocialiteProviders\Manager\OAuth2\AbstractProvider
and
OAuth1 providers need to utilize the \SocialiteProviders\Manager\OAuth1\AbstractProvider
and \SocialiteProviders\Manager\OAuth1\Server
.
You can access it from the user object like so: $user->accessTokenResponseBody
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。