Auto Login facebook user into application
- by user537562
So, Here is the scenario I am trying to fix.
A returning user is logged into facebook but not logged into the application. In this case when the user tries to load the application, since the user cookie is not attained yet, it redirects the user to the login page.
I googled around and found this solution,
FB.Event.subscribe('auth.sessionChange', function(response) {
if (response.session) {
window.location.reload();
}
}
basically whats happening here is, we are registering to facebook for a login/logout event and when it receives a response, we reload the page. Now its loads the right page since we have the user cookie on our site domain after the first load.
this works, but the problem is the double load. It takes a lot of time.
How can I attain the user cookie on server side for returning user? so that I don't have to do the initial page reload.
Also, I have looked at yelp, and somehow they are able to load the user information without doing double load, does any body know they are able to do it?
Any help is greatly appreciated,
Thanks!