public function getAuthToken($user, $plainPassword, $firewall, $roles = array())
    {
        // Here, "public" is the name of the firewall in your security.yml
        $token = new UsernamePasswordToken($user, $user->getPlainPassword(), $firewall, $roles);

        // For older versions of Symfony, use security.context here
        $this->tokenStorage->setToken($token);

        return $token;
    }
public function getAuthToken($user, $plainPassword, $firewall, $roles = array())
    {
        // Here, "public" is the name of the firewall in your security.yml
        $token = new UsernamePasswordToken($user, $user->getPlainPassword(), $firewall, $roles);

        // For older versions of Symfony, use security.context here
        $this->tokenStorage->setToken($token);

        return $token;
    }
public function getAuthToken ( $ user , $ plainPassword , $ firewall , $ roles = array ( ) ) { // Here, "public" is the name of the firewall in your security.yml $ token = new UsernamePasswordToken ( $ user , $ user -> getPlainPassword ( ) , $ firewall , $ roles ) ; // For older versions of Symfony, use security.context here $ this -> tokenStorage -> setToken ( $ token ) ; return $ token ; }
Get by Code.
@param  [type] $user [user to auth]
@param  [type] $user [user's plain password]
@param  [type] $firewall [name in security.yml]
@param  [type] $roles [user's roles]
@return [bool] token [description]
Get by Code .