I'm 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's what my app/HTTP/Controllers/Auth/LoginController class 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 get undefined class Socialite when I add use Socialite;
I tried composer dump-autoload
and php artisan config:clear
but nothing is working. Am I doing something wrong?
I'm using Laravel 5.4 and Socialite 3.0
Thanks!