FriendsOfSymfony / FOSFacebookBundle

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

Authenticate user by facebook, but do not persist entity #286

Closed qdelettre closed 10 years ago

qdelettre commented 10 years ago

I need to authenticate (and retrieve data) my user via facebook, and prefill a form that will create the user only at submission.

Can i alter the behavior of fosuserbundle & fosfacebookbundle to achieve this ?

My current project is persisting the user entity at login, this is not the behavior i want.

diegoholiveira commented 10 years ago

Yes, you can.

You need to use an AuthenticationHandler to redirect the user to your registration form and change your FacebookProvider to only return the user (and not save it on the database).

qdelettre commented 10 years ago

I implemented the method onAuthenticationSuccess where i redirect to the form, in a LoginSuccessHandler that implements AuthenticationSuccessHandlerInterface.

My FacebookProvider is this one https://gist.github.com/qdelettre/6505770 . Still the entity is persisted before the user submit the form.