Driver [provider] not supported laravel/socialite
Asked Answered
E

7

5

I'm using Laravel 5.4 and Socialite 3.0

With every new socialite provider I add I get the error:

Driver [provider] not supported.

for example when adding socialiteproviders/twitch 3.0 I will get the error:

Driver [twitch] not supported.

However I can use a provider that's already built in to Socialite, github for example works as expected.

I have tried three different providers and I get the same result each time, what am I doing wrong?

Here are my routes:

Route::get('/auth/bnet', 'BnetController@redirectToProvider');

Route::get('/auth/bnet/return', function() {
    $user = Socialite::driver('battlenet')->user();
    dd($user->accessTokenResponseBody);
});

Route::get('/auth/git', function() {
    return Socialite::driver('github')->redirect();
});

Route::get('/auth/twitch', function() {
    return Socialite::with('twitch')->redirect();
});

Here's my $listen from my EventServiceProvider:

    protected $listen = [
      \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // add your listeners (aka providers) here
        //'SocialiteProviders\Battlenet\BattlenetExtendSocialite@handle',
        'Reflex\SocialiteProviders\BattleNet\BattleNetExtendSocialite@handle',
        'SocialiteProviders\Twitch\TwitchExtendSocialite@handle',
      ],
    ];

I have added SocialiteProviders\Manager\ServiceProvider::class, to my providers array in app.php, I have added the Socialite facade ('Socialite' => Laravel\Socialite\Facades\Socialite::class,) to my aliases array also in app.php and have added the appropriate keys to my .env

Exultant answered 7/8, 2017 at 20:14 Comment(0)
S
12

I had the same issue and I found solution.

In config/app.php providers array:

'providers' => [
    // ...
    Laravel\Socialite\SocialiteServiceProvider::class,
    \SocialiteProviders\Manager\ServiceProvider::class,
    // ...
]

In app/Providers/EventServiceProvider.php:

protected $listen = [
// ...
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        'SocialiteProviders\VKontakte\VKontakteExtendSocialite@handle',
    ],
]

You missed \ at start of 'SocialiteProviders\Twitch\TwitchExtendSocialite@handle'.

Striptease answered 30/11, 2017 at 12:58 Comment(0)
G
3

Hopefully this helps someone, but I found that I had to separate the EventServiceProvider.php listen classes with "\\" instead of "\". Laravel 5.6. e.g:

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        'SocialiteProviders\\Twitch\\TwitchExtendSocialite@handle',
        'SocialiteProviders\\Podio\\PodioExtendSocialite@handle',
    ],

If you're still struggling, triple-check to ensure all of the packages are installed.

I also found that including...

Laravel\Socialite\SocialiteServiceProvider::class,

...in your config/app.php is not necessary when using SocialiteProviders\Manager.

Gauguin answered 20/6, 2018 at 19:46 Comment(1)
Including Laravel\Socialite\SocialiteServiceProvider::class causes the problem.Alamo
V
1

Make sure that you have updated config/services.php to include the client_id client_secret and redirect from your provider.

Clear your config and try again.

Valorie answered 15/6, 2019 at 21:52 Comment(0)
O
1

Adding an answer here because this question comes up while searching for the same error as it pertains to Lumen as well and I suspect others may run into the same issue that I did.

The Lumen-specific documentation for additional providers doesn't appear to mention some gotchas (at least, for my version of Lumen) and Lumen needs a little extra configuration to work compared to Laravel.

I'm on Lumen 5.8.2 and had been becoming increasingly frustrated getting Socialite with additional providers set up - all of my configuration in bootstrap/app.php and EventServiceProvider.php seemed correct (and was) until I realized that Lumen wasn't actually registering the EventServiceProvider itself.

To remedy this problem, register the EventServiceProvider within your bootstrap/app.php setup:

$app->register(App\Providers\EventServiceProvider::class);

With the EventServiceProvider registered, just refer to the other answers here to configure events, the provider's service config and registering Socialite in app.php and you ought to be good to go.

Oeillade answered 28/6, 2019 at 14:54 Comment(0)
D
1

In my case (Laravel version 11.x) I needed to go at app/Providers/AppServiceProvider.php and add these lines inside boot() function.

// Register the Azure provider with the Socialite event
Event::listen(function (SocialiteWasCalled $event) {
     $event->extendSocialite('azure', \SocialiteProviders\Azure\Provider::class);
});

and these imports before class declaration

use Illuminate\Support\Facades\Event;
use SocialiteProviders\Manager\SocialiteWasCalled;
Delusive answered 5/9, 2024 at 18:23 Comment(1)
This is also needed for laravel 10 setupsTaxexempt
D
0

I had the same issue, to solve it i change the order of my bootstrap/app.php config, try moving the next lines after the Event ServiceProvider:

$app->register(\SocialiteProviders\Manager\ServiceProvider::class);
class_alias(Laravel\Socialite\Facades\Socialite::class, 'Socialite');
//$app->register(Laravel\Socialite\SocialiteServiceProvider::class);

After:

$app->register(App\Providers\EventServiceProvider::class);

My issue was because i declared all the Socialite and SocialiteProvider stuff before.

Drayman answered 8/8, 2020 at 1:10 Comment(0)
S
0

I had the same issue and my php version was 7 and I found solution. In config/app.php providers array add these 2 lines and then it worked:

    Laravel\Socialite\SocialiteServiceProvider::class,
    \SocialiteProviders\Manager\ServiceProvider::class,

make sure you have already installed your provider socialite package, in your case it would be:

    composer require socialiteproviders/twitch
Streetwalker answered 20/3, 2024 at 1:52 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.