在网络应用程序中登录Facebook

Facebook login in a web app

本文关键字:登录 Facebook 应用程序 网络      更新时间:2023-09-26

我正在尝试在我的Web应用程序中实现Facebook登录。 我得到了应用程序ID,我的代码如下。 我的脸书登录页面

  <div id="fb-root"></div>
  <script>
    window.fbAsyncInit = function() {
      FB.init({
        appId      : '<<App Id>> ', // App ID
        channelUrl : '//www. DOMAIN NAME.com/channel.html', // Channel File
        status     : true, // check login status
        cookie     : true, // enable cookies to allow the server to access the session
        xfbml      : true  // parse XFBML
      });
      // Additional initialization code here
    };
    // Load the SDK Asynchronously
    (function(d){
       var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
       if (d.getElementById(id)) {return;}
       js = d.createElement('script'); js.id = id; js.async = true;
       js.src = "//connect.facebook.net/en_US/all.js";
       ref.parentNode.insertBefore(js, ref);
     }(document));
  </script><div class="fb-login-button"><a href=" ">Login with Facebook</a></div>
</body>

`.我正在尝试运行它,它为我的应用程序提供了错误。我也得到了密钥,但不知道确切地放在哪里。我们是否需要为此放置任何 css 或 js 或任何其他文件?

任何帮助将不胜感激。

appId      : '<<App Id>> ', //Place App ID
channelUrl : '//www. DOMAIN0 NAME.com/channel.html', // Place domain here