src/PN/Bundle/UserBundle/Security/Core/User/FOSUBUserProvider.php
/**
     * Attach OAuth sign-in provider account to existing user
     *
     * @param FOSUserInterface      $user
     * @param UserResponseInterface $response
     *
     * @return FOSUserInterface
     */
Attach OAuth sign-in provider account to existing user
@param FOSUserInterface      $user
@param UserResponseInterface $response


Attach OAuth sign - in provider account to existing user @param FOSUserInterface $user @param UserResponseInterface $response
protected function updateUserByOAuthUserResponse(User $user, UserResponseInterface $response) {
        $providerName = $response->getResourceOwner()->getName();
        $providerNameSetter = 'set' . ucfirst($providerName) . 'Id';
        $user->$providerNameSetter($response->getUsername());
        if (!$user->getPassword()) {
            $secret = md5(uniqid(rand(), true));
            $user->setPassword($secret);
        }
        return $user;
    }
protected function updateUserByOAuthUserResponse ( User $ user , UserResponseInterface $ response ) { $ providerName = $ response -> getResourceOwner ( ) -> getName ( ) ; $ providerNameSetter = 'set' . ucfirst ( $ providerName ) . 'Id' ; $ user -> $ providerNameSetter ( $ response -> getUsername ( ) ) ; if ( ! $ user -> getPassword ( ) ) { $ secret = md5 ( uniqid ( rand ( ) , true ) ) ; $ user -> setPassword ( $ secret ) ; } return $ user ; }
Attach OAuth sign-in provider account to existing user
 @param FOSUserInterface      $user
 @param UserResponseInterface $response
Attach OAuth sign - in provider account to existing user @param FOSUserInterface $user @param UserResponseInterface $response
// generate unique token