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).

有帮助吗?

解决方案

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"

其他提示

Also did you include your bundle services.yml in the main config file?

 #/app/config/config.yml

 imports:
    - { resource: parameters.yml }
    - { resource: security.yml }
    - { resource: "@UserBundle/Resources/config/services.yml" }

My error was that I had

    secured_area:
         oauth:
             resource_owners:
                 facebook:           "/login/check-facebook"
                 twitter:            "/login/check-google"

instead of

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

in the file security.yml

Thanks.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top