【问题标题】:HWIOAuthBundle & FOSUserBundle integrationHWIOAuthBundle 和 FOSUserBundle 集成
【发布时间】:2013-08-02 15:05:41
【问题描述】:

我遵循了这两个文档: https://github.com/hwi/HWIOAuthBundle/tree/master/Resources/doc(用于 HWIOAuth) https://gist.github.com/danvbe/4476697(将 HWIOAuth 与 FOSUB 集成)

我得到了这个错误

ServiceNotFoundException:您请求了一个不存在的服务“hwi_oauth.resource_ownermap.main”。

我在 stackoverflow 中发现了同样的错误: Symfony2.3 - HWIOAuthBundle Config ServiceNotFoundException

但我认为我在config.yml中的ressource_owners配置得很好。

这里是:

 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

我有正确的值而不是 X(没有任何“”我不知道我是否应该添加这个)。

【问题讨论】:

    标签: php symfony oauth fosuserbundle hwioauthbundle


    【解决方案1】:

    security.yml 中防火墙的resources_owners 部分也必须配置以避免该错误。

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

    【讨论】:

    • 谢谢问题是我有secure_area而不是main。
    【解决方案2】:

    您是否还在主配置文件中包含了您的捆绑包services.yml

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

    【讨论】:

      【解决方案3】:

      我的错误是我有

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

      而不是

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

      在文件security.yml中

      谢谢。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2014-07-31
        • 1970-01-01
        • 2015-05-18
        • 1970-01-01
        相关资源
        最近更新 更多