public function callback(Request $request, $provider)
    {
        $this->checkDisabled();

        $this->checkProvider($provider);

        $this->setConfig($provider);

        $user = User::find(Auth::id());

        $redirectAfter = url('/');

        if ($user) {
            $redirectAfter = !($user->hasPermission('laralum::access') || $user->superAdmin()) ?: route('laralum::social.integrations');
        }

        $user = Socialite::driver($provider)->user();

        if ($user->getEmail() && $user->getName()) {
            if (Auth::check()) {
                if (!Social::where(['user_id' => Auth::id(), 'provider' => $provider])->first()) {
                    $this->registerSocial($provider, $user);

                    return redirect($redirectAfter)->with('success', __('laralum_social::general.provider_linked', ['provider' => $provider]));
                }

                return redirect($redirectAfter)->with('error', __('laralum_social::general.provider_already_linked', ['provider' => $provider]));
            }

            $sa = Social::where(['email' => $user->getEmail(), 'provider' => $provider])->first();

            if ($sa) {
                Auth::login($sa->user);

                return redirect($redirectAfter)->with('success', __('laralum_social::general.logged_in', ['provider' => $provider]));
            }

            abort(403, 'Registrations are not allowed using the social feature');
        }

        abort(403, 'The provider did not return a valid email or name to register the user');
    }
public function callback(Request $request, $provider)
    {
        $this->checkDisabled();

        $this->checkProvider($provider);

        $this->setConfig($provider);

        $user = User::find(Auth::id());

        $redirectAfter = url('/');

        if ($user) {
            $redirectAfter = !($user->hasPermission('laralum::access') || $user->superAdmin()) ?: route('laralum::social.integrations');
        }

        $user = Socialite::driver($provider)->user();

        if ($user->getEmail() && $user->getName()) {
            if (Auth::check()) {
                if (!Social::where(['user_id' => Auth::id(), 'provider' => $provider])->first()) {
                    $this->registerSocial($provider, $user);

                    return redirect($redirectAfter)->with('success', __('laralum_social::general.provider_linked', ['provider' => $provider]));
                }

                return redirect($redirectAfter)->with('error', __('laralum_social::general.provider_already_linked', ['provider' => $provider]));
            }

            $sa = Social::where(['email' => $user->getEmail(), 'provider' => $provider])->first();

            if ($sa) {
                Auth::login($sa->user);

                return redirect($redirectAfter)->with('success', __('laralum_social::general.logged_in', ['provider' => $provider]));
            }

            abort(403, 'Registrations are not allowed using the social feature');
        }

        abort(403, 'The provider did not return a valid email or name to register the user');
    }
public function callback ( Request $ request , $ provider ) { $ this -> checkDisabled ( ) ; $ this -> checkProvider ( $ provider ) ; $ this -> setConfig ( $ provider ) ; $ user = User :: find ( Auth :: id ( ) ) ; $ redirectAfter = url ( '/' ) ; if ( $ user ) { $ redirectAfter = ! ( $ user -> hasPermission ( 'laralum::access' ) || $ user -> superAdmin ( ) ) ? : route ( 'laralum::social.integrations' ) ; } $ user = Socialite :: driver ( $ provider ) -> user ( ) ; if ( $ user -> getEmail ( ) && $ user -> getName ( ) ) { if ( Auth :: check ( ) ) { if ( ! Social :: where ( [ 'user_id' => Auth :: id ( ) , 'provider' => $ provider ] ) -> first ( ) ) { $ this -> registerSocial ( $ provider , $ user ) ; return redirect ( $ redirectAfter ) -> with ( 'success' , __ ( 'laralum_social::general.provider_linked' , [ 'provider' => $ provider ] ) ) ; } return redirect ( $ redirectAfter ) -> with ( 'error' , __ ( 'laralum_social::general.provider_already_linked' , [ 'provider' => $ provider ] ) ) ; } $ sa = Social :: where ( [ 'email' => $ user -> getEmail ( ) , 'provider' => $ provider ] ) -> first ( ) ; if ( $ sa ) { Auth :: login ( $ sa -> user ) ; return redirect ( $ redirectAfter ) -> with ( 'success' , __ ( 'laralum_social::general.logged_in' , [ 'provider' => $ provider ] ) ) ; } abort ( 403 , 'Registrations are not allowed using the social feature' ) ; } abort ( 403 , 'The provider did not return a valid email or name to register the user' ) ; }
Obtain the user information from the provider.

@return Response
Obtain the user information from the provider .