0

I am using Facebook integration for one of my symfony2 application. I have used FOSUserBundle and FOSFacebookUserBundle.

I can able to login through form in my application and user session was created. Same when I am using FB to login my application FB session created. Here I want to create my User session as like we do it via form_login.

Will FOSFacebookBundle providing any authentication or Do we need to write separate authentication provider for the same?

I have done all the setup what is given in FOsUserBUndle and FOSFacebookBundle.

Can anyone help me on this?

Beginner
  • 379
  • 1
  • 4
  • 14

1 Answers1

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.

Beginner
  • 379
  • 1
  • 4
  • 14