Search code examples
phpsymfonyoauthfosuserbundlehwioauthbundle

HWIOAuthBundle & FOSUserBundle integration


I followed these two documentations : https://github.com/hwi/HWIOAuthBundle/tree/master/Resources/doc (for HWIOAuth) https://gist.github.com/danvbe/4476697 (to integrate HWIOAuth with FOSUB)

And I get this error

ServiceNotFoundException: You have requested a non-existent service "hwi_oauth.resource_ownermap.main".

I found the same error in stackoverflow : Symfony2.3 - HWIOAuthBundle Config ServiceNotFoundException

But I think that my ressource_owners in config.yml is well configured.

Here is it :

 fos_user:
    db_driver: orm
    firewall_name: main
    user_class: MyProject\UserBundle\Entity\User
    registration:
        form:
            type: myproject_user_registration
        confirmation:
            enabled: true
            template: FOSUserBundle:Registration:email.txt.twig



 hwi_oauth:
    firewall_name: main
    fosub:
        username_iterations: 30
        properties:
            yahoo: yahoo_id
            google: google_id
            windows_live: windows_live_id
            linkedin: linkedin_id
    resource_owners:
        any_name:
            type:                yahoo
            client_id:           X
            client_secret:       X
        any_name:
            type:                google
            client_id:           X
            client_secret:       X
            scope:               X 
        any_name:
            type:                windows_live
            client_id:           X
            client_secret:       X           
        any_name:
            type:                linkedin
            client_id:           X
            client_secret:       X
            scope:               X

I have the right values instead of X (without any "" I don't know if I should add this).


Solution

  • The resources_owners section of the firewall in security.yml must also be configured to avoid that error.

    firewalls:
        main:
            oauth:
                resource_owners:
                    facebook:           "/login/check-facebook"
                    twitter:            "/login/check-google"