正在尝试使用Symfony HWIOAuthBundle为我的网站实现Google登录
我的问题是:
"security.firewalls.secured_area.oauth“下的未识别选项"google”
我的client_id和client_secret是好的,收到谷歌的,我只是不粘贴它,因为隐私。
我正在使用这个HWIOAuthBundle文档
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 }发布于 2017-02-12 13:55:20
在您的security.ym中,google选项应该在resource_owners下面,您必须添加一个制表符空间,并且它应该可以工作。
resource_owners:
google: "/login/check-google"https://stackoverflow.com/questions/42188004
复制相似问题