2014-08-29 80 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 
相關問題