繁体   English   中英

HWIOAuthBundle和FOSUserBundle集成

[英]HWIOAuthBundle & FOSUserBundle integration

我遵循了以下两个文档: 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(没有任何“”,我不知道是否应该添加此值)。

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

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

您是否还在主配置文件中包括了bundle services.yml

 #/app/config/config.yml

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

我的错误是我有

    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中

谢谢。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM