Fosuserbundle: Having error while installing FOSUserBundle. Running on Symfony 3.0.4.

Created on 13 Apr 2016  路  4Comments  路  Source: FriendsOfSymfony/FOSUserBundle

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]
The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.fos_userbundle".

Most helpful comment

Well, you defined providers twice in your Yaml file. And according to the Yaml spec, the first occurrence is used. This means that you don't define any provider named fos_userbundle, but only one named in_memory.
so this breaks later when trying to use the fos_userbundle provider for form login.

this tells me we are missing a validation in Symfony to provide a better error message in such case though.

All 4 comments

please paste your config for the SecurityBundle

Security.yml :

security:

    # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
    providers:
        in_memory:
            memory: ~
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        #dev:
        #    pattern: ^/(_(profiler|wdt)|css|images|js)/
        #    security: false

        main:
            anonymous: true
            pattern: ^/
            form_login:
                provider: fos_userbundle
                login_path: /login
                check_path: fos_user_security_check
                # if you are using Symfony < 2.8, use the following config instead:
                # csrf_provider: form.csrf_provider

            logout:       true
            anonymous:    true
            # activate different ways to authenticate

            # http_basic: ~
            # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate

            # form_login: ~
            # http://symfony.com/doc/current/cookbook/security/form_login_setup.html

    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: ^/chat, role: ROLE_ADMIN }

config.yml :

fos_user:
    db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
    firewall_name: main
    user_class: Application\FormsBundle\Entity\User

Well, you defined providers twice in your Yaml file. And according to the Yaml spec, the first occurrence is used. This means that you don't define any provider named fos_userbundle, but only one named in_memory.
so this breaks later when trying to use the fos_userbundle provider for form login.

this tells me we are missing a validation in Symfony to provide a better error message in such case though.

yes tahs it man thanks very much.

Was this page helpful?
0 / 5 - 0 ratings