带有 hwiOAuthBundle 的 Symdony2 错误:您请求了一个不存在的服务
error Symdony2 with hwiOAuthBundle: you have requested a non existing service
我在 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 {
}
我终于找到了 2 个有用的教程来解决这个问题。这是链接
我在 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 {
}
我终于找到了 2 个有用的教程来解决这个问题。这是链接