0

我正在为我的 symfony2 应用程序之一使用 Facebook 集成。我使用过 FOSUserBundle 和 FOSFacebookUserBundle。

我可以通过我的应用程序中的表单登录并创建用户会话。当我使用 FB 登录我创建的应用程序 FB 会话时也是如此。在这里,我想创建我的用户会话,就像我们通过 form_login 一样。

FOSFacebookBundle 是否会提供任何身份验证,或者我们是否需要为此编写单独的身份验证提供程序?

我已经完成了 FOsUserBUndle 和 FOSFacebookBundle 中给出的所有设置。

谁可以帮我这个事?

4

1 回答 1

0

Finally, I have fixed the issue.

Yes, FosFacebookBundle will create user session for application.

We no need to write authentication provider.(But we should have Facebook Provider to authenticate on it. like given in FosFacebookBundle basic usage document).

my security.yml firewall config:

firewalls:
    main:
        pattern: ^/
        anonymous:    true
        form_login:
            login_path:  /
            check_path:  _security_check
            failure_path:  login_failure
            success_handler: Projectfolder.authentication.success_handler
        fos_facebook:
            login_path: /
            check_path: _security_check_facebook
            provider: fos_facebook_provider
            default_target_path: /

        logout:
            path:   /logout
            target: /

My routing.yml :

_security_check_facebook:
    pattern:   /facebook/login_check
    defaults:  { _controller: ProjectfolderUserBundle:Security:loginFb }

_security_facebook_logout:
    pattern:  /facebook/logout

Note: _security_facebook_logout, we won't use in our application. While logout we will remove only application user session not facebook session. We can use this url during development.

I have called login_check instead of /facebook/login_check. So User session is not set in my application. Now it's working fine.

于 2013-10-07T05:45:07.930 回答