FriendsOfSymfony / FOSFacebookBundle

NOT MAINTAINED - see https://github.com/hwi/HWIOAuthBundle
322 stars 140 forks source link

Auto login if app has been accepted #182

Open tiagojsag opened 12 years ago

tiagojsag commented 12 years ago

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

ecentinela commented 11 years ago

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

lutzportela commented 11 years ago

sounds like third party cookie restrictions

honestbleeps commented 11 years ago

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

bassrock commented 11 years ago

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

rat4m3n commented 11 years ago

+1 same

amine2z commented 11 years ago

+1 same

olgierds commented 11 years ago

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

diegoholiveira commented 11 years ago

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.

joanteixi commented 11 years ago

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.

mstaples commented 11 years ago

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

technico commented 10 years ago

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