首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >HWIOAuthBundle与FOSUserBundle集成

HWIOAuthBundle与FOSUserBundle集成
EN

Stack Overflow用户
提问于 2013-08-02 15:05:41
回答 3查看 3.7K关注 0票数 2

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

我得到了这个错误

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

我在堆栈溢出中发现了相同的错误:Symfony2.3 - HWIOAuthBundle Config ServiceNotFoundException

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

这就是:

代码语言:javascript
复制
 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(没有任何"“我不知道是否应该添加这个)。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2013-08-02 20:20:08

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

代码语言:javascript
复制
firewalls:
    main:
        oauth:
            resource_owners:
                facebook:           "/login/check-facebook"
                twitter:            "/login/check-google"
票数 2
EN

Stack Overflow用户

发布于 2013-08-03 04:41:38

另外,您是否在主配置文件中包含了包services.yml

代码语言:javascript
复制
 #/app/config/config.yml

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

Stack Overflow用户

发布于 2013-08-05 09:47:38

我的错误是

代码语言:javascript
复制
    secured_area:
         oauth:
             resource_owners:
                 facebook:           "/login/check-facebook"
                 twitter:            "/login/check-google"

而不是

代码语言:javascript
复制
    main:
         oauth:
             resource_owners:
                 facebook:           "/login/check-facebook"
                 twitter:            "/login/check-google"

在文件security.yml中

谢谢。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18020242

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档