Page 1 of 1

Laravel socialite facebook login does not work.. (ed:Solved)

Posted: Thu Nov 23, 2017 5:04 am
by hybris
Hi, I followed this tutorial: https://appdividend.com/2017/07/12/lara ... ook-login/
to add a facebook login but I get this error:

ErrorException (E_NOTICE)
Undefined variable: service

it is in the callback function:
$user = $service->createOrGetUser(Socialite::driver('facebook')->user());

Code: Select all

public function callback()
    {
        $user = $service->createOrGetUser(Socialite::driver('facebook')->user());
        auth()->login($user);
        return redirect()->to('/home');
    }
it says service is an undefined variable.

Where should the $service variable be declared? (I suspect something might have gone wrong when I installed socialite... is there any way to check that?)

Thanks :)

Re: Laravel socialite facebook login does not work..

Posted: Thu Nov 23, 2017 9:36 am
by hybris
Never mind.. I got it to work :)