I tried to integrate Facebook with Parse. I followed the next guide, https://parse.com/docs/js_guide#fbusers , but still experiencing problems.
In short, there is a login button with facebook. When the user does not exist, he redirects the user to the registration page, and when his existing user redirects them to the city page with their choice on the account creation page. If the user cancels the registration process, upon logging in, he transfers the existing user to the account registration page.
However, the facebook screen appears only when the user does not exist and does not complete the registration process. The following are the warnings I receive when I try to log in:
About console warnings / errors
The 'status' flag is passed to FB.init, if set to true, it may prevent Parse from integrating Facebook, so it was suppressed. Please call FB.getLoginStatus () explicitly if you require this behavior.
FB.init is already called - this may indicate a sdk.js problem: 61 AuthResponse configuration is not supported
- You must initialize FacebookUtils before calling logIn.
- Called by FB.login () when the user is already connected.
The following is the JavaScript code:
// Initialize Parse Parse.initialize("ID", "ID"); window.fbAsyncInit = function() { Parse.FacebookUtils.init({ // this line replaces FB.init({ appId : '433936150095453', // Facebook App ID status : true, // check Facebook Login status cookie : true, xfbml : true, // initialize Facebook social plugins on the page version : 'v2.2' // point to the latest Facebook Graph API version }); // Run code after the Facebook SDK is loaded. }; (function(d, s, id){ var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) {return;} js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/en_US/sdk.js"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk')); function fbLogin(){ Parse.FacebookUtils.logIn(null, { success: function(user) { if (!user.existed()) { window.open("accountCreate.html", "_self"); } else { if (city == "San Francisco") { window.open("neighbourhoodselectSF.html", "_self"); } else if (city == "New York City"){ window.open("neighbourhoodSelectNYC.html", "_self"); } else { window.open("accountCreate.html", "_self"); } } }, error: function(user, error) { alert("User cancelled the Facebook login or did not fully authorize."); } }); }
Html code:
<button onclick="fbLogin()" id="facebookLogin" class="button button-block button-positive"> <i class="icon ion-social-facebook"></i> <text id="textBtn">Get started with facebook </text> </button> <script src="js/facebook.js"></script>
<script src="lib/facebookConnectPlugin.js"></script>
Any help would be greatly appreciated.