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

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
hybris
Forum Contributor
Posts: 172
Joined: Wed Sep 25, 2013 4:09 am

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

Post 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 :)
Last edited by hybris on Thu Nov 23, 2017 9:37 am, edited 1 time in total.
hybris
Forum Contributor
Posts: 172
Joined: Wed Sep 25, 2013 4:09 am

Re: Laravel socialite facebook login does not work..

Post by hybris »

Never mind.. I got it to work :)
Post Reply