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

Created on 22 Dec 2017  路  10Comments  路  Source: FriendsOfSymfony/FOSUserBundle

Symfony FOSUserBundle versions: v2.0.2
Symfony version: 3.4
Symfony Flex: yes

Description of the problem including expected versus actual behavior:
Users cannot login when using correct credentials. The login form will give following error: "Authentication request could not be processed due to a system problem.". Cannot find any errors in the command prompt of the server. Also the log files are empty.

Steps to reproduce:

  1. Install Symfony 3.4 with Symfony Flex
  2. Configure FosUserBundle like the config from 3.3
  3. Try to login

The config/packages/fos_user.yaml file looks like:

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: App\Entity\User
    from_email: # Use this node only if you don't want the global email address for the confirmation email
                address:        [email protected]
                sender_name:    Webmaster JimmyD

    registration:
        confirmation:
            from_email: # Use this node only if you don't want the global email address for the confirmation email
                address:        [email protected]
                sender_name:    Webmaster 
            enabled:    true # change to true for required email confirmation
            template:   FOSUserBundle:Registration:email.txt.twig

The config/routes.yaml looks like:

fos_user:
    resource: "@FOSUserBundle/Resources/config/routing/all.xml"

And the config/packages/security.yaml looks like:

security:
    providers:
        in_memory: { memory: ~ }
        fos_userbundle:
            id: fos_user.user_provider.username_email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: ~

            # activate different ways to authenticate
            pattern: ^/
            form_login:
                check_path: /login_check
                login_path: /login
                provider: fos_userbundle
                always_use_default_target_path: true
                default_target_path: /user/home
            logout:
                path: /logout
                target: /login

            anonymous:    true

    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_USER:       ROLE_USER
        ROLE_ADMIN:     [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/, role: ROLE_ADMIN }
        - { path: ^/user/, role: ROLE_USER }
        - { path: ^/profile/, role: ROLE_USER }
        - { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }

Most helpful comment

This could also be that your app is not connecting to the database.

All 10 comments

I have the same issue with Fosuserbundle in a Symfony Flex environment. Tried everything and I'm getting the same not explaning error. Also my logs are empty.

After debugging and checking the Fos errors in debug I found the issue. My User entity was not correct.

Symfony FOSUserBundle versions: v2.1
Symfony version: 4.1
Symfony Flex: yes

I have same issue, and no log too...

Do not forget to check your /var/log/dev.log to check for errors since this error is a very generic one. The dev.log will provide you more details

check your connectionstring, your user privileges for your database, password, etc

Maybe it can still help to somebody:

After a long time debugging I found the issue in my case. When using nginx and php-fpm owner of /var/lib/php/session folder was after installation root:apache, so session couldn't be created. Note that I haven't installed apache. (this is centos thing)

This could also be that your app is not connecting to the database.

One other possible reason, the linked repository to your entity doesn't reference the correct entity. Can happen when you copy/paster the code too quickly.

One other possible reason, the linked repository to your entity doesn't reference the correct entity. Can happen when you copy/paster the code too quickly.

What shall we do in this case ?
I get the same error message. This happened after an update

clearing the cache solved it for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DeveloperSlope3 picture DeveloperSlope3  路  5Comments

Dine90 picture Dine90  路  5Comments

suhasini1212 picture suhasini1212  路  5Comments

soullivaneuh picture soullivaneuh  路  6Comments

philrennie picture philrennie  路  4Comments