2014-08-29 73 views
1

我安装了HWIOAuthBundle。HWIOAuthBundle:没有名称为“check-google”的资源所有者

但是我有这样的错误,当我尝试与谷歌帐户登录:

没有的ressource所有者名为“入住谷歌”。

和我有同样的errror与其他API(Facebook,微博...)

这是我security.yml:

firewalls: 
    main: 
     pattern: ^/login$ 
     security: true 
     anonymous: true 
     provider: user_provider 
     form_login: 
      login_path: fos_user_security_login 
      check_path: fos_user_security_check 
     logout: 
      path: fos_user_security_logout 
      target:/
     oauth: 
      resource_owners: 
       facebook:   "/login/check-facebook" 
       google:    "/login/check-google" 
       twitter:   "/login/check-twitter" 
       linkedin:   "/login/check-linkedin" 
      login_path:  /login 
      check_path:  /login 
      failure_path:  /login 

      oauth_user_provider: 
       #this is my custom user provider, created from FOSUBUserProvider - will manage the 
       #automatic user registration on your site, with data from the provider (facebook. google, etc.) 
       service: my_user_provider 

我的routing.yml:

#HWIOAuthBundle routes 
    hwi_oauth_security: 
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml" 
    prefix: /connect/by 

hwi_oauth_connect: 
    resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml" 
    prefix: /connect/by 

hwi_oauth_redirect: 
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml" 
    prefix: /login 

facebook_login: 
    pattern: /login/check-facebook 
    options: { i18n: false } 

google_login: 
    pattern: /login/check-google 
    options: { i18n: false } 

twitter_login: 
    pattern: /login/check-twitter 

linkedin_login: 
    pattern: /login/check-linkedin 

和我config.yml:

# HWIOAuthBundle 
hwi_oauth: 
    connect: 
     account_connector: my_user_provider 
    firewall_name: main 
    fosub: 
     username_iterations: 30 
     properties: 
      # these properties will be used/redefined later in the custom FOSUBUserProvider service. 
      facebook: facebook_id 
      google: google_id 
      twitter: twitter_id 
      linkedin: linkedin_id 
    resource_owners: 
     facebook: 
      type:    facebook 
      client_id:   xxxxx 
      client_secret:  xxxxx 
      scope:    "" 
      options: 
       display: popup 
     google: 
      type:    google 
      client_id:   xxxx 
      client_secret:  xxxx 
      scope:    "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile" 
     twitter: 
      type:    twitter 
      client_id:   xxxx 
      client_secret:  xxxx 
      scope:    "" 
     linkedin: 
      type:    linkedin 
      client_id:   xxxx 
      client_secret:  xxxx 
      scope:    "r_basicprofile" 

services: 
    hwi_oauth.user.provider.entity: 
     class: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider 
    cmf_create.persistence.orm.object_mapper: 
     class: Midgard\CreatePHP\Mapper\DoctrineOrmMapper 
     arguments: 
      - "%cmf_create.map%" 
      - "@doctrine" 

我的问题与No resource owner with name 'google' (HWIOAuthBundle & FOSUserBundle integration)相同。我怎样才能解决这个问题 ?

+0

什么URL被抛出异常?你能从你的stacktrace发布多一点吗? – 2014-08-29 22:21:56

回答

0

我解决了这个问题。我发现这个链接有帮助:

http://m2mdas.github.io/blog/2013/11/21/integrate-hwioauthbundle-with-fosuserbundle/

在上面的链接,之后我加入cacert.pem的路径,它解决了这个问题。

HWIOAuthBundle使用Buzz curl客户端与Web服务进行通信。 Buzz默认启用SSL证书检查。在某些服务器上CA证书信息可能不存在。要添加CA证书信息从此页面下载cacert.pem并将curl.cainfo php ini变量设置为cacert.pem的位置,例如 curl.cainfo = /path/to/cacert.pem

而我错过了上述步。

问候,

Mk6ix

1

我最好的选择是你的防火墙是不活动的 “登录与*” 的网址

尝试改变:

pattern: ^/login$ 

我本人来说使用防火墙的所有URL:

pattern: ^/ 

并明确设置公开的网址:

access_control: 
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY } 
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY } 
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY } 
    - { path: ^/admin/, role: ROLE_ADMIN } 
    - { path: ^/add, role: ROLE_USER } 
1

我一直运行到同一个问题:

No ressource owner with name 'check-google'. 

对我来说是改变的routing.yml这一解决:

google_login: 
    pattern: /api/login/check/google 
相关问题