Laravel Socialite driver not supported

I’m trying to get an existing Laravel 5.1 app to work with Okta authentication for my day job, using tequilarapido’s socialite-okta. But I’m getting errors. So I tried a simple proof-of-concept app, thus:

composer create-project laravel/laravel tequila-demo 5.1.*
cd tequila-demo
composer require tequilarapido/socialite-okta

…and then I did the socialite-okta setup:

# Added Tequilarapido service provider and Socialite alias to config/app.php
# Added 'okta' config to config/services.php and .env

…and finally I did the Laravel Social Auth setup:

# Added Socialite service provider to config/app.php
# Added redirectToProvider() and handleProviderCallback() to /app/Http/Controllers/Auth/AuthController.php
# Added auth/okta and auth/okta/callback routes to app/Http/routes.php

…but when I pointed the browser at I got an error:

InvalidArgumentException in Manager.php line 90:
Driver [okta] not supported.

And I was stumped.

Then I found this issue which gave me the hint to add the following to the boot() function in app/Providers/AppServiceProvider.php (with some tweaking based on socialite-okta/src/SocialiteManager.php).

Socialite::extend('okta', function ($app) {
$config = $app['config']['services.okta'];
$provider = Socialite::buildProvider('Tequilarapido\Okta\OktaProvider', $config);
return $provider;

And lo and behold, once we set up the app in Okta and configured everything in the .env file, it works perfectly.

You can re-live the excitement in the commit history of the git repository, if you’ve a mind to do so.

Laravel Socialite driver not supported