14

I have installed my Symfony project on another computer with the same specifications, and I receive the following error when I login with fosuserbundle:

Authentication request could not be processed due to a system problem.

I can't find anything of interest in the app/logs files. I run the app in dev mode. Cleared cache both manually and from the console. I setup the db with doctrine:database:create. It works to create a new user with fos:user:create and it's successfully saved to the database.

I have no idea where to go from here.

estrar
  • 1,373
  • 4
  • 12
  • 37

10 Answers10

26

Check to make sure your database is up to date. This fixed my issue when I received this error.

php app/console doctrine:schema:update --dump-sql

edit: spelling

J-who
  • 550
  • 5
  • 9
5

Had the same issue while working in dev environment. I updated my User's model, and every time I tried to login I had your error. Solved by running:

app/console cache:clear

EDIT: Had the same issue again. This time it's happened because I moved my project to another server and forgot to update parameters.yml to match the server's MySQL credentials.

Bob
  • 2,430
  • 22
  • 27
  • 1
    Where do I run those commands? Im having the same issue. But I cant find any solution on how to clear cache the files on my EB. – jofftiquez Dec 19 '15 at 05:54
  • 1
    @TheGreenFoxx Open your terminal; navigate to your Symfony's project directory, and then the `app` subfolder. Here you'll find the `console` file (it's in fact a php file with no extension). Type on your terminal `php console cache:clear` and that will clear your cache for the "dev" environment (run `php console cache:clear --env=prod` if you're in production). – Bob Dec 21 '15 at 07:56
2

It looks like that the error:

Authentication request could not be processed due to a system problem.

is too generic and does not tell anything about where the problem is (there is an issue opened about this matter here).

I solved my issue by checking the logs and see what happened (in var/logs/dev.log), hoping this helps someone.

In my specific case, there was a wrong parameter in parameters.yml about database.

Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
1

You might have set a wrong password in your parameters.yml because of which it might not be able to connect to the DB. The above mentioned error occurs when the app is not able to connect to DB to check if the user is authentic. (I also faced the same error and this was my problem, hope it helps)

1

In a deploy process usually it's an environment problem (assuming that the app works fine in a dev station). FOSUserBundle it's great but for some reason it doesn't show very well the problems behind it.

As the error message says: ".. could not be processed due to a system problem."

if cleaning the cache nor updating the schema works, I would recommend try to bypass FOSUserBundle (usually the issue is between your code/configuration and the server environment) and let your bundle with the default errorhandler and logger inform any problem.

in my case it was a driver problem. (install pdo)

to bypass it, the simplest way is to remove security to a controller_action in security.yml

access_control:
{ path: ^/SomeCRUD, role: IS_AUTHENTICATED_ANONYMOUSLY }

then, if you access it, it should be able to log the issue and you should be able to fix it.

hope it helps

Jonos
  • 103
  • 1
  • 9
  • Well ... it works for me. I believed that the purpose of the question was to find out what "system problem" behind the FOSUserBundle is avoiding the login process and I just tell my experience in a deploy that I have done in which I struggle with the same issue and the way I solve it. Sorry for not being helpful though. – Jonos Jul 31 '15 at 17:52
0

Make sure that your User entity implements the UserInterface

<?php

namespace UserBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;

/**
 * BaseUser
 */
class BaseUser implements UserInterface
{
    /**
     * @var integer
     */
    protected $id;

    /**
     * @var string
     */
    protected $name;

    /**
     * @var string
     */
    protected $username;

    /**
     * @var string
     */
    protected $password;

    /**
     * @var string
     */ 
    protected $email;

    /**
     * @var string
     * 
     */
    protected $roles;

    /**
     * @var boolean
     */
    protected $isActive;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     * @return BaseUser
     */
    public function setName($name)
    {
        $this->name = $name;

        return $this;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set username
     *
     * @param string $username
     * @return BaseUser
     */
    public function setUsername($username)
    {
        $this->username = $username;

        return $this;
    }

    /**
     * Get username
     *
     * @return string 
     */
    public function getUsername()
    {
        return $this->username;
    }

    /**
     * Set password
     *
     * @param string $password
     * @return BaseUser
     */
    public function setPassword($password)
    {
        if (!is_null($password)) {
            $this->password = $password;
        }

        return $this;
    }

    /**
     * Get password
     *
     * @return string 
     */
    public function getPassword()
    {
        return $this->password;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return BaseUser
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string 
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set roles
     *
     * 
     * @return BaseUser
     */
    public function setRoles($roles)
    {
        $this->roles = $roles;
    }

    /**
     * Get roles
     */
    public function getRoles()
    {
        // Do what ever make sense to you here 
        return explode("|", $this->roles)
    }

    /**
     * Set isActive
     *
     * @param boolean $isActive
     * @return BaseUser
     */
    public function setIsActive($isActive)
    {
        $this->isActive = $isActive;

        return $this;
    }

    /**
     * Get isActive
     *
     * @return boolean 
     */
    public function getIsActive()
    {
        return $this->isActive;
    }

    public function eraseCredentials()
    {
    }

    public function getSalt()
    {
        return null;
    }
}
Nezar Fadle
  • 1,335
  • 13
  • 11
0

If you've generated the database using doctrine:database:create, maybe your charset isn't appropriate. Because User table has a serialized field (roles) a wrong encoding could be the cause.

You can check this looking into app/logs and your database collation.

Alternatively, check this answer

Community
  • 1
  • 1
Nicolas Castro
  • 1,436
  • 1
  • 14
  • 15
0

I had the same problem. I was able to build and populate the database with php app/console doctrine:schema:update --force; php app/console doctrine:fixtures:load; but the symfony app couldn't access the database.

The problem was I'd set database_host: 127.0.0.1 in parameters.yml but mysql was expecting me to connect through localhost. Updating parameters.yml fixed the problem. I'm still confused as to why the command line stuff worked...

jxmallett
  • 4,087
  • 1
  • 28
  • 35
0

I was having the exact same issue. And the steps I took were the following:

  1. I cleared the cache
  2. I brought down all my db tables and recreated them again via my migrations
  3. I replaced where I had used single quotes(') with double quotes(") in my entity annotations for arguments to constraint methods

    Example

    //src/SomeBundle/Model/user.php
    <?php
    /**
    *
    * @Assert\File(
    *  maxSize='512k',
    *  mimeTypes={'image/png', 'image/jpeg', 'image/gif'},
    *  mimeTypesMessage= 'Please upload a valid png, gif or jpeg file below 512Kb'
    * )
    */
    private $profilePic;
    
    ?>
    

    This got replaced with

    <?php
    /**
    *
    * @Assert\File(
    *  maxSize="512k",
    *  mimeTypes={"image/png", "image/jpeg", "image/gif"},
    *  mimeTypesMessage= "Please upload a valid png, gif or jpeg file below 512Kb"
    * )
    */
    private $profilePic;
    ?>
    

After doing this, I tried the authentication again and it worked!

oyelaking
  • 444
  • 5
  • 7
0

I had the problem Symfony 2.3 and when I execute app/console doctrine:schema:update --dump-sql this is the result.

DROP INDEX UNIQ_957A647992FC23A8 ON fos_user; DROP INDEX UNIQ_957A6479A0D96FBF ON fos_user; ALTER TABLE fos_user DROP username, DROP username_canonical, DROP email, DROP email_canonical, DROP enabled, DROP salt, DROP password, DROP last_login, DROP locked, DROP expired, DROP expires_at, DROP confirmation_token, DROP password_requested_at, DROP roles, DROP credentials_expired, DROP credentials_expire_at;

It started working again just after I updated doctrine-bundle from 1.2 to 1.3.

Info:

https://github.com/FriendsOfSymfony/FOSUserBundle/issues/2140

maccevedor
  • 155
  • 2
  • 5