FOSFacebookBundle icon indicating copy to clipboard operation
FOSFacebookBundle copied to clipboard

Auto login if app has been accepted

Open tiagojsag opened this issue 13 years ago • 11 comments

Hi, all,

I don't know if this is a bug, a feature that needs implementing, or a problem with my configuration, but here's what's happening: Authentication using facebook is working fine, the first time i press the button, I get the FB popup, I accept and i get a user created on my local db (i'm integrating with fos user) and roles and all set on session.

After that session expires, if I visit my site's login page, I get the "logout" facebook button. In order to login again on my site using FB, I have to logout and login on FB using that button.

Is there any way to, after permissions have been accepted for my site's fb app, automatically login a user when he enters the site (any page) or when he enters a restricted page and gets redirected to the login page?

Thanks in advance

tiagojsag avatar Aug 17 '12 15:08 tiagojsag

Same problem here. I don't know how to solve it, but it's behaviour it's weird!

ecentinela avatar Oct 10 '12 15:10 ecentinela

sounds like third party cookie restrictions

lutzportela avatar Oct 17 '12 12:10 lutzportela

I have the same issue. No 3rd party cookie restrictions.

honestbleeps avatar Oct 18 '12 06:10 honestbleeps

I have the same problem. Do we have a workable solution yet?

bassrock avatar Nov 09 '12 03:11 bassrock

+1 same

rat4m3n avatar Nov 10 '12 18:11 rat4m3n

+1 same

amine2z avatar Nov 30 '12 15:11 amine2z

hi, had the same problem, just changed autologoutlink to false in facebook_button.html.twig helper:

{{ facebook_login_button({'autologoutlink': false, 'label': button_text ? button_text : 'Login with Facebook' }) }}

I also don't use fos_facebook.logout_handler to log out, just have logout:true in security.yml

olgierds avatar Jan 01 '13 20:01 olgierds

This problem happens with me too, but it's a client side problem (with Facebook JS SDK). FOSFacebookBundle it's about server side: it provide a firewall to sf2 security component.

I'm preparing a better documentation for the bundle and I'll share my solution for this issue.

diegoholiveira avatar Jan 01 '13 21:01 diegoholiveira

Hi, I solved with an ugly workaround...

  1. In my own facebookprovider, if user exists, set a session variable: fb_new_user = false
  2. Created a listener for success_handler key on facebook firewall.
  3. This listener, on success, check for session variable and return the correct URL.

So, if user exists on login, I redirect to home page and not to my steps for register through facebook.

joanteixi avatar Jan 25 '13 13:01 joanteixi

Same issue; olgierds fix of changing autologoutlink to false was all I needed.

mstaples avatar Mar 25 '13 22:03 mstaples

@olgierds by setting "autologoutlink" to "false" it worked for me ! thank you ^_^

technico avatar Apr 16 '14 09:04 technico