Refactor Facebook login using js SDK