我正在Symfony2
的一个项目中工作,我需要使用facebook
个用户登录我的应用程序,所以我安装了HwiOAuthBundle
,当我运行我的应用程序时,我得到了此错误:You have requested a non-existent service "hwi_oauth.account.connector"
这是我对该软件包的配置:
config.yml:
hwi_oauth:
firewall_name: main_hwi
http_client:
verify_peer: false
connect:
confirmation: true
resource_owners:
facebook:
type: facebook
client_id: "%oauth.facebook.id%"
client_secret: "%oauth.facebook.secret%"
security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
OC\UserBundle\Entity\User: sha512
role_hierarchy:
ROLE_ADMIN: [ROLE_AUTEUR, ROLE_MODERATEUR]
ROLE_SUPER_ADMIN: [ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
hwi:
id: oc.oauth.user_provider
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main_hwi:
context: user
pattern: /.*
oauth:
resource_owners:
facebook: /login/check-facebook
login_path: /connect
failure_path: /connect
oauth_user_provider:
service: oc.oauth.user_provider
logout: true
anonymous: true
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
的routing.yml
hwi_oauth_connect:
resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
prefix: /connect
hwi_oauth_redirect:
resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
prefix: /connect
hwi_oauth_login:
resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
prefix: /login
facebook_login:
pattern: /login/check-facebook
oc_platform:
resource: "@OCPlatformBundle/Resources/config/routing.yml"
prefix: /platform
UserProvider.php
<?php
namespace OC\PlatformBundle\OAuth;
use HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider as BaseOAuthUserProvider;
class UserProvider extends BaseOAuthUserProvider {
}