Undefined class Socialite in Spark Laravel 5.4
I am new to Laravel and Spark trying to figure out how / where I should add my new controllers and add Socialite.
In my providers, I added
Laravel\Socialite\SocialiteServiceProvider::class,
In my aliases, I added
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
Here my application class / HTTP / Controllers / Auth / LoginController looks like
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Socialite;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
/**
* Redirect the user to the GitHub authentication page.
*
* @return Response
*/
public function redirectToProvider()
{
return Socialite::with('github')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('github')->user();
// $user->token;
}
}
I am getting undefined Socialite class when I add use Socialite;
I've tried composer dump-autoload
and php artisan config:clear
but nothing works. Am I doing something wrong?
I am using Laravel 5.4 and Socialite 3.0
Thank!
+3
source to share