diff --git a/guides/socialite-providers.md b/guides/socialite-providers.md index 164d42d..e5d5fb4 100644 --- a/guides/socialite-providers.md +++ b/guides/socialite-providers.md @@ -50,11 +50,9 @@ Icon location: `resources/js/Components/SocialstreamIcons/` ### Socialstream Providers -Inside your applications `socialstream.php` config file, you will want to add the string representation of the SocialiteProvider you are adding support for. For example, if you are adding Sign in With Apple support, you would add the string `'apple'` to the `providers` array: - -``` -// ./config/socialstream.php +Inside your applications `socialstream.php` config file, you will want to add the string representation of the SocialiteProvider you are adding support for. For example, if you are adding Sign in With Apple support, you would add the string `'apple'` to the `providers` array in `config/socialstream.php` +```php 'providers' => [ \JoelButcher\Socialstream\Providers::github(), \JoelButcher\Socialstream\Providers::google(), @@ -66,23 +64,68 @@ Inside your applications `socialstream.php` config file, you will want to add th ], ``` -### Service Providers +### Service Provider + +#### Laravel 11+ -When using Socialstream alongside Socialite Providers, you will need **both** service providers adding your the `providers` array in you application's `app.php` config file: +In `bootstrap/providers.php`. ```php -'providers' => [ - // ... - \App\Providers\SocialstreamServiceProvider::class, // keep - // ... +return [ + // a whole bunch of providers + // remove 'Laravel\Socialite\SocialiteServiceProvider', + \SocialiteProviders\Manager\ServiceProvider::class, // add +]; +``` - // ... - // remove 'Laravel\Socialite\SocialiteServiceProvider::class', +#### In Laravel 10 or Below + +In `config\app.php`. + +```php +'providers' => [ + // a whole bunch of providers + // remove 'Laravel\Socialite\SocialiteServiceProvider', \SocialiteProviders\Manager\ServiceProvider::class, // add - // ... ]; ``` +### Add provider event listener + +#### Laravel 11+ + +In Laravel 11, the default `EventServiceProvider` provider was removed. Instead, add the listener using the `listen` method on the `Event` facade, in your `AppServiceProvider` `boot` method. + +* Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers. + +```php +Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) { + $event->extendSocialite('microsoft', \SocialiteProviders\Microsoft\Provider::class); +}); +``` + +
+ +Laravel 10 or below + +Configure the package's listener to listen for `SocialiteWasCalled` events. + +Add the event to your `listen[]` array in `app/Providers/EventServiceProvider`. See the [Base Installation Guide](https://socialiteproviders.com/usage/) for detailed instructions. + +```php +protected $listen = [ + \SocialiteProviders\Manager\SocialiteWasCalled::class => [ + // ... other providers + \SocialiteProviders\Microsoft\MicrosoftExtendSocialite::class.'@handle', + ], +]; +``` + +\ + + +
+ ### Database Changes – `token` {% hint style="danger" %}