使用 js sdk 登录 facebook

Login with facebook with js sdk

I am trying to do login with facebook but their is an error and is not allowing users to login and the error is ERROR: 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.

           <html>
           <head>
             <title>Login with Facebook</title>
           </head>
           <body>

             <div id="fb-root"></div>
             <script>
         window.fbAsyncInit = function() {
           FB.init({
             appId      : '555437747988297',
             channelUrl : '//booknow.drbatras.ae/channel.html', // Channel File
             xfbml      : true,
             version    : 'v2.7'
           });
         };

         (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'));
       </script>

         <div class="fb-login-button">Login with Facebook</div>

       </body>

转到 facebook 的开发者网站 -> 使用您的应用程序的管理员帐户登录,然后从菜单 select 您的应用程序,在应用程序的高级设置选项卡中添加您的域,然后错误将不会显示向上

  • 删除 channelUrl 参数(不再需要)
  • 在您的应用程序设置中添加 "Website" 平台,并使用您的 URL
  • 在您的应用程序设置中添加 "App Domains" 的域