我尝试使用google配置这个包以进行授权。我在google中看到文档和搜索,但仍然无法配置。
现在我有一个错误:
The service "hwi_oauth.security.oauth_utils" has a dependency on a non-existent service "hwi_oauth.resource_ownermap.main".现在我只想在google的默认页面链接中显示,当我单击它时,我希望得到google的响应,并在var转储中显示它。
routing.yml:
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /login
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
google_login:
path: /login/check-googleconfig.yml
hwi_oauth:
connect:
account_connector: defaultbundle.oauth_provider
firewall_names: [secured_area]
resource_owners:
google:
type: google
client_id: ****
client_secret: ****
scope: "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"security.yml
secured_area:
pattern: ^/
anonymous: ~
oauth:
resource_owners:
google: "/login/check-google"
login_path: /login
use_forward: false
failure_path: /login
oauth_provider:
service: defaultbundle.oauth_provider
logout: true
anonymous: true
# access_control:
# - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }services.yml
defaultbundle.oauth_provider:
class: Public\defaultBundle\Auth\OAuthProvider
arguments: [@doctrine]base.html
<a href="{{ path('hwi_oauth_service_redirect', {'service': 'google' }) }}">
<span>Google</span>
</a>OAuthProvider.php
use HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider;
use HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface;
use HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface;
class OAuthProvider extends OAuthUserProvider
{
}发布于 2016-01-12 14:45:50
hwi_oauth配置中的config.yml防火墙名称(当前: main)是错误的。它必须与使用ouath的security.yml (当前: secured_area)中的防火墙名称匹配。
hwi_ouath:
connect:
account_connector: defaultbundle.oauth_provider
firewall_name: secured_area # <---- here is the change (if using 0.3)
firewall_names: [secured_area] # <--- if using 0.4
...文档:
https://stackoverflow.com/questions/34743803
复制相似问题