Кнопка входа в Facebook не появится и не будет работать - PullRequest
0 голосов
/ 12 марта 2019

Я пытаюсь добавить простую кнопку входа в систему, которая выдает много ошибок, и я даже не вижу кнопку (думаю, что-то базовое отсутствует в моем коде)

My html :

           <fb:login-button scope="public_profile,email" onlogin="checkLoginState();"><br></fb:login-button><br><div id="status"><br></div>

JS :

function statusChangeCallback(response) {

    // The response object is returned with a status field that lets the app    know        the current login status of the person.
  if (response.status === 'connected') {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' + response.name);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.name + '!';
    });
  } else if (response.status === 'not_authorized') {
    // The person is logged into Facebook, but not your app.
    document.getElementById('status').innerHTML = 'Please log ' + 'into this app.';
  } else {
    // The person is not logged into Facebook, so we're not sure if they are logged into this app or not.
    document.getElementById('status').innerHTML = 'Please log ' + 'into Facebook.';
  }

}


// This function is called when someone finishes with the Login Button.
function checkLoginState() {
  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  });
}





// Load the SDK asynchronously
(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 = "https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.5";

    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));




window.fbAsyncInit = function() {
  FB.init({
    appId : 'XXXXXXXXXXXXXXXX',
    cookie : true, // enable cookies to allow the server to access the session
    xfbml : true, // parse social plugins on this page
    version : 'v2.1' // use version 2.1
  });

  // Now that we've initialized the JavaScript SDK, we call FB.getLoginStatus().
  // This function gets the state of the person visiting this page.
  FB.getLoginStatus(function(response) {
    statusChangeCallback(response);
  });
};

Я получаю много ошибок и не вижу кнопку (работает на моем Mac локально и открывается в Chromeинспектор).

The method FB.getLoginStatus will soon stop working when called from http pages. Please update your site to use https for Facebook Login.

The Login Button plugin will soon stop working on http pages. Please update your site to use https for Facebook Login.



Can't Load URL: The domain of this URL isn't included in the app's domains. To be able to load this URL, add all domains and subdomains of your app to the App Domains field in your app settings.
...