I'm not sure if this is what is really causing my issue, but perhaps someone will know. When I use Laravel Socialite and go:
$social_user = Socialite::driver($provider)->user();
Then somewhere else in my code is do this:
if ($authUser = User::where('provider_id', $social_user->id))
return $authUser;
For some crazy reason I get an error like this:
Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, instance of Illuminate\Database\Eloquent\Builder given
However if I do this I don't get an error:
if($authUser = User::where('email', $social_user->email)->first())
return $authUser;
I log this user in like this:
Auth::login($authUser, true);
Does anyone know why? I'm using laravel 5.2