symfonysonata-user-bundlefosoauthserverbundle

The service “security.authentication.manager” has a dependency on a non-existent service “security.user.provider.concrete.fos_userbundle”


I am having quite a frustrating problem and don't even know where to troubleshoot because Symfony is not mentioning the offender.

I need to build an OAUTH server to authenticate mobile users on an App that already had Sonata User Admin/ FOSUser bundles working perfectly.

I elected to install FOSOAuthServerBundle which I have used before perfectly without much trouble. Today howerver, I keep getting the following error:

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

Here are my relevant files:

config.yml

fos_user:
    db_driver:      orm # can be orm or odm
    firewall_name:  main
    user_class:     Application\Sonata\UserBundle\Entity\User

    group:
        group_class:   Application\Sonata\UserBundle\Entity\Group
        group_manager: sonata.user.orm.group_manager                    

    service:
        user_manager: sonata.user.orm.user_manager

fos_oauth_server:
    db_driver: orm
    client_class:        AppBundle\Entity\Client
    access_token_class:  AppBundle\Entity\AccessToken
    refresh_token_class: AppBundle\Entity\RefreshToken
    auth_code_class:     AppBundle\Entity\AuthCode
    service:
        user_provider:  sonata.user.orm.user_manager
        options:
            supported_scopes: user

security.yml

providers:
    fos_userbundle:
        id: fos_user.user_manager

encoders:
    FOS\UserBundle\Model\UserInterface: sha512    

firewalls:

    dev:
        pattern: ^/(_(profiler|wdt|error)|css|images|js)/
        security: false

    oauth_token:
        pattern:    ^/oauth/v2/token
        security:   false

    admin:
        pattern:            /admin(.*)
        context:            user
        form_login:
            provider:       fos_userbundle
            login_path:     /admin/login
            use_forward:    false
            check_path:     /admin/login_check
            failure_path:   null
        logout:
            path:           /admin/logout
        anonymous:          true

    oauth_authorize:
        pattern:    ^/oauth/v2/auth
        form_login:
            provider: user_provider
            check_path: _security_check
            login_path: _demo_login
        anonymous: true

    api:
        pattern:    ^/api
        fos_oauth:  true
        stateless:  true

    main:
        pattern:             .*
        context:             user
        form_login:
            provider:       fos_userbundle
            login_path:     /login
            use_forward:    false
            check_path:     /login_check
            failure_path:   null
        logout:             true
        anonymous:          true

There's an almost similar question here The service "security.authentication.manager" has a dependency on a non-existent service "security.user.provider.concrete.fos_userbundle" but the his issue was brought about by omiting fos_userbundle id under providers which is the case in my situation.

Someone please assist in shedding some light


Solution

  • Your error must be here :

    oauth_authorize:
            pattern:    ^/oauth/v2/auth
            form_login:
                provider: user_provider #where is this provider? shouldnt it be fos_userbundle
                check_path: _security_check
                login_path: _demo_login
            anonymous: true