2017-02-12 37 views
0

想实现登录谷歌使用的Symfony HWIOAuthBundle我的网站无法识别的选项“谷歌”,“security.firewalls.secured_area.oauth”下

我的问题:

无法识别的选项“谷歌” 下“security.firewalls.secured_area.oauth”

我的client_id和client_secret很好,并且从Google收到,我只是不会因为隐私而粘贴它。

现在用这个HWIOAuthBundle Documentation

hwi_oauth: 
    firewall_names: [secured_area] 
    resource_owners: 
     any_name: 
      type:    google 
      client_id:   myid 
      client_secret:  mysecret 
      scope:    "https://www.googleapis.com/auth/plus.login" 
      options: 
       request_visible_actions: "http://schemas.google.com/AddActivity http://schemas.google.com/CommentActivity" 

Security.yml文件:

安全:

# http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers 
providers: 
    in_memory: 
     memory: ~ 

firewalls: 
    # disables authentication for assets and the profiler, adapt it according to your needs 

    dev: 
     pattern: ^/(_(profiler|wdt)|css|images|js)/ 
     security: false 

    #main: 
    default: 

     anonymous: ~ 
     http_basic: ~ 
     # activate different ways to authenticate 

     # http_basic: ~ 
     # http://symfony.com/doc/current/book/security.html#a-configuring-how-your-users-will-authenticate 

     # form_login: ~ 
     # http://symfony.com/doc/current/cookbook/security/form_login_setup.html 

#access_control: 
    # require ROLE_ADMIN for /main* 
    # - { path: ^/main, roles: ROLE_ADMIN } 

    secured_area: 

     anonymous: ~ 
     oauth: 
     resource_owners: 

     google:    "/login/check-google" 

     login_path:  /login 
     use_forward:  false 
     failure_path:  /login 

     oauth_user_provider: 

      service: my.oauth_aware.user_provider.service 

access_control: 
      - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY } 
+0

你能过去你的security.yml文件吗? 该错误表示你有一个问题下security.firewalls.secured_area.oauth –

+0

我粘贴,你能帮我。谢谢 – Darius92

回答

1

在你security.ym的google选项应该是resource_owners下,你必须添加一个标签空间,它应该工作。

resource_owners: 
     google:   "/login/check-google" 
+0

'服务定义“my.oauth_aware.user_provider.service”不存在.'现在我需要定义我的服务在'service.yml'文件中? – Darius92

+0

是的,你需要那 –

+0

我很困惑它,这是正确的吗? '服务: my.oauth_aware.user_provider.service: 类:HWI \捆绑\ OAuthBundle \ HWIOAuthBundle 参数:[ 'hwi_oauth.user.provider',{谷歌:CLIENT_ID}]' – Darius92

相关问题