0

I'm trying to add HWIOAuthBundle in my existing project, and i'm stuck with this error message :

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] Unable to replace alias "hwi_oauth.user.provider.fosub_bridge" with "hwi_oaut

[Symfony\Component\DependencyInjection\Exception\InvalidArgumentException] The service definition "hwi_oauth.user.provider.fosub_bridge" does not exist.

PS C:\wamp\www\test> php app/console debug:container hwi_oauth.user.provider.fosub_bridge



  [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
  Unable to replace alias "hwi_oauth.user.provider.fosub_bridge" with "hwi_oauth.user.provider.entity.main".

  [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
  The service definition "hwi_oauth.user.provider.fosub_bridge" does not exist.

My configuration is :

#config.yml
    fos_user:
        db_driver:     orm                       
        firewall_name: main                       
        user_class:    ScopIt\UserBundle\Entity\User 

    hwi_oauth:
        firewall_name: main
        resource_owners:
            any_name:
                type:          azure
                client_id:     <client_id>
                client_secret: <client_secret>

                options:
                    resource:    https://graph.windows.net
                    application: common

#Security.yml
security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

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

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

    firewalls:
        main:
            pattern: ^/
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
            logout:       true
            switch_user: { role: ROLE_ADMIN, parameter: _want_to_be_this_user }
            anonymous:    true
            form_login:
                # submit the login form here
                check_path: /login_check

                # the user is redirected here when they need to log in
                login_path: /login

                # if true, forward the user to the login form instead of redirecting
                use_forward: false

                # login success redirecting options (read further below)
                always_use_default_target_path: true
                default_target_path:            /
                use_referer:                    false
            oauth:
                resource_owners:
                    azure:           "/login/check-azure"
                login_path:        /login
                use_forward:       false
                failure_path:      /login
                oauth_user_provider:
                    service: hwi_oauth.user.provider.fosub_bridge

    access_control:
        - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/, role: ROLE_ADMIN }

Any idea where i'm wrong ?

Thanks for your help,

  • I have idea: the service you provided in `oauth_user_provider` config does not exist. – malcolm Sep 18 '15 at 18:38
  • This example configuration always worked for me: https://gist.github.com/danvbe/4476697 – malcolm Sep 18 '15 at 18:47
  • So you think i have to create a FOSUBUserProvider, it's not clear in the documentation, sure they have not something already available in the pluggin ? – Sauget Charles-Henri Sep 19 '15 at 08:59
  • I don't think that, I provided link to "how to" that working for me. I see that I have the service: `php app/console debug:container hwi_oauth.user.provider.fosub_bridge` and if I switch to it it works too when I login via facebook. – malcolm Sep 19 '15 at 09:22
  • I tested php app/console debug:container hwi_oauth.user.provider.fosub_bridge and i've the same error message. (I edited my thread with it) – Sauget Charles-Henri Sep 19 '15 at 16:20

0 Answers0