src/Gzero/Social/SocialLoginService.php
public function login($serviceName, AbstractUser $response)
    {
        $userId = $this->repo->getUserIdBySocialId($response->id, $serviceName);
        if (auth()->check()) { // user already logged and service has not been connected
            $user = auth()->user();
            if ($userId) { // This service has already been connected
                session()->put('url.intended', route('connectedServices'));
                throw new SocialException(
                    trans(
                        'gzero-social::common.service_already_connected_message',
                        ['service_name' => title_case($serviceName)]
                    )
                );
            } else { // create connection for new service
                $this->repo->addUserSocialAccount($user, $serviceName, $response);
            }
        } else {
            if ($userId) { // login user with this service
                $this->auth->loginUsingId($userId);
            } else { // create new user
                $user = $this->repo->createNewUser($serviceName, $response);
                $this->auth->login($user);
                session()->put('showWelcomePage', true);
                session()->put('url.intended', route('account.welcome', ['method' => title_case($serviceName)]));
            }
        }
    }
public function login($serviceName, AbstractUser $response)
    {
        $userId = $this->repo->getUserIdBySocialId($response->id, $serviceName);
        if (auth()->check()) { // user already logged and service has not been connected
            $user = auth()->user();
            if ($userId) { // This service has already been connected
                session()->put('url.intended', route('connectedServices'));
                throw new SocialException(
                    trans(
                        'gzero-social::common.service_already_connected_message',
                        ['service_name' => title_case($serviceName)]
                    )
                );
            } else { // create connection for new service
                $this->repo->addUserSocialAccount($user, $serviceName, $response);
            }
        } else {
            if ($userId) { // login user with this service
                $this->auth->loginUsingId($userId);
            } else { // create new user
                $user = $this->repo->createNewUser($serviceName, $response);
                $this->auth->login($user);
                session()->put('showWelcomePage', true);
                session()->put('url.intended', route('account.welcome', ['method' => title_case($serviceName)]));
            }
        }
    }
public function login ( $ serviceName , AbstractUser $ response ) { $ userId = $ this -> repo -> getUserIdBySocialId ( $ response -> id , $ serviceName ) ; if ( auth ( ) -> check ( ) ) { // user already logged and service has not been connected $ user = auth ( ) -> user ( ) ; if ( $ userId ) { // This service has already been connected session ( ) -> put ( 'url.intended' , route ( 'connectedServices' ) ) ; throw new SocialException ( trans ( 'gzero-social::common.service_already_connected_message' , [ 'service_name' => title_case ( $ serviceName ) ] ) ) ; } else { // create connection for new service $ this -> repo -> addUserSocialAccount ( $ user , $ serviceName , $ response ) ; } } else { if ( $ userId ) { // login user with this service $ this -> auth -> loginUsingId ( $ userId ) ; } else { // create new user $ user = $ this -> repo -> createNewUser ( $ serviceName , $ response ) ; $ this -> auth -> login ( $ user ) ; session ( ) -> put ( 'showWelcomePage' , true ) ; session ( ) -> put ( 'url.intended' , route ( 'account.welcome' , [ 'method' => title_case ( $ serviceName ) ] ) ) ; } } }
Login using social service.

@param $serviceName string social service name
@param $response    AbstractUser response data

@throws SocialException
Login using social service .