src/Synapse/SocialLogin/SocialLoginService.php
public function registerFromSocialLogin(LoginRequest $request)
    {
        $email = $request->getEmails()[0];
        $user  = $this->userService->registerWithoutPassword(array(
            'email' => $email
        ));

        $socialLoginEntity = new SocialLoginEntity;
        $socialLoginEntity->setUserId($user->getId())
            ->setProvider($request->getProvider())
            ->setProviderUserId($request->getProviderUserId())
            ->setAccessToken($request->getAccessToken())
            ->setAccessTokenExpires($request->getAccessTokenExpires())
            ->setRefreshToken($request->getRefreshToken());

        $entity = $this->socialLoginMapper->persist($socialLoginEntity);
        return array(
            'user'         => $user,
            'social_login' => $entity
        );
    }
public function registerFromSocialLogin(LoginRequest $request)
    {
        $email = $request->getEmails()[0];
        $user  = $this->userService->registerWithoutPassword(array(
            'email' => $email
        ));

        $socialLoginEntity = new SocialLoginEntity;
        $socialLoginEntity->setUserId($user->getId())
            ->setProvider($request->getProvider())
            ->setProviderUserId($request->getProviderUserId())
            ->setAccessToken($request->getAccessToken())
            ->setAccessTokenExpires($request->getAccessTokenExpires())
            ->setRefreshToken($request->getRefreshToken());

        $entity = $this->socialLoginMapper->persist($socialLoginEntity);
        return array(
            'user'         => $user,
            'social_login' => $entity
        );
    }
public function registerFromSocialLogin ( LoginRequest $ request ) { $ email = $ request -> getEmails ( ) [ 0 ] ; $ user = $ this -> userService -> registerWithoutPassword ( array ( 'email' => $ email ) ) ; $ socialLoginEntity = new SocialLoginEntity ; $ socialLoginEntity -> setUserId ( $ user -> getId ( ) ) -> setProvider ( $ request -> getProvider ( ) ) -> setProviderUserId ( $ request -> getProviderUserId ( ) ) -> setAccessToken ( $ request -> getAccessToken ( ) ) -> setAccessTokenExpires ( $ request -> getAccessTokenExpires ( ) ) -> setRefreshToken ( $ request -> getRefreshToken ( ) ) ; $ entity = $ this -> socialLoginMapper -> persist ( $ socialLoginEntity ) ; return array ( 'user' => $ user , 'social_login' => $ entity ) ; }
Register a new user account from a social login provider

@param  LoginRequest $request
@return array                  Array containing user and social login
Register a new user account from a social login provider