我正在为我的应用程序进行社交网络登录/注册。
我使用过HWIOAUTHBUNDLE。它对我的开发服务器工作正常,但我已将我的代码上传到我的实时服务器,它给了我以下错误:
无法找到路径“/ oauth-login / check-google”的控制器。也许您忘了在路由配置中添加匹配路由?
我正在与您分享我的配置文件:
的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: /oauth-login
linkedin_login:
pattern: /oauth-login/check-linkedin
twitter_login:
pattern: /oauth-login/check-twitter
google_login:
pattern: /oauth-login/check-google
security.yml
security:
providers:
chain_provider:
chain:
providers: [fos_userbundle, oauth_user_provider]
fos_userbundle:
id: fos_user.user_provider.username_email
oauth_user_provider:
id: myapp.oauth.user.provider
encoders:
FOS\UserBundle\Model\UserInterface: sha512
firewalls:
admin:
pattern: ^/admin
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
check_path: /admin/login_check
login_path: /admin/login
default_target_path: /admin/dashboard
always_use_default_target_path: true
logout:
path: /admin/logout
anonymous: ~
main:
pattern: ^/
context: shared_login_context
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
check_path: /login_check
login_path: /login
default_target_path: /flashboard
always_use_default_target_path: true
success_handler: myapp.user.login_success_handler
logout: true
anonymous: true
remember_me:
key: XXX
lifetime: 604800
hwi_oauth:
context: shared_login_context
pattern: ^/oauth-login/?$
oauth:
resource_owners:
linkedin: "/oauth-login/check-linkedin"
twitter: "/oauth-login/check-twitter"
google: "/oauth-login/check-google"
login_path: /connect
failure_path: /login
oauth_user_provider:
service: myapp.oauth.user.provider
config.yml
hwi_oauth:
connect:
confirmation: true
firewall_name: hwi_oauth
target_path_parameter: "target_path"
http_client:
timeout: 60
fosub:
username_iterations: 30
properties:
linkedin: linkedinId
twitter: twitterId
resource_owners:
linkedin:
type: linkedin
client_id: XXX
client_secret: XXX
scope: XXX
twitter:
type: twitter
client_id: XXX
client_secret: XXX
google:
type: google
client_id: XXX
client_secret: XXX
scope: XXX
答案 0 :(得分:0)
将您的login_path更改为
/ OAuth的登录
在security.yml文件中。