5 months ago

Laravel Socialite - Sign up on Facebook

Posted 5 months ago by davy_yg


public function handleProviderCallback($provider)
    try {
        // it doesn't return anything then error
        $user = Socialite::driver($provider)->user();
    } catch (Exception $e){
        return redirect('/login');

    $authUser = $this->findOrCreateUser($user, $provider);

    // Login and "remember" the given user
    Auth::login($authUser, true);

    return redirect($this->redirectTo);


Route::get('login/{provider}/callback', 'Auth\[email protected]');


<div class="panel-footer">
                <a href="{{ url('login/facebook') }}" class="btn btn-social btn-facebook">

                    <i class="fa fa-facebook"></i>
                    Sign Up with Facebook

When I press Sign Up with Facebook button. Send Profile and Photo to Facebook. I click Yes. Then:

URL: http://localhost/login/facebook/callback?code=AQB0Dzj1jrH-bwg9akRFeCFGnlP93XvP6I9RwdQtjciO58eWDTqvtbdBgPhR4ACeM7knqlkRzo0YHF8clh45hGYK1B3xlWxFYVlG5m6dAkQXl1b_Z72UVPMdkAo7A-123OoYIOeJca8kfaJ2ZnAmDU_9yT4bz9W3z7aF2uoipvXxJmOnN2VjG_57yUe_e8ND8i418NEm3JqB3OLsuGRk2hMB7q8zEgGfwIuBUdUP5w1xTkINsm-VQgm8ZHYpDsrctoO34vGDAjt-MnJIhBLNUnUEqiXcURBGgv2m6J6-hbUv8lrWsAe_oFD7yGVasaJ0g3VHidhAR3oLM9ldP2_BvnEw&state=fS1nK6Sd8thfMPQ9JTwUvmlrNHcNMFYIsqpD5qlk#_=_

Object not found!

The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

If you think this is a server error, please contact the webmaster. Error 404 localhost Apache/2.4.35 (Win32) OpenSSL/1.1.0i PHP/7.2.11

Please sign in or create an account to participate in this conversation.