2017-09-14 32 views
-2

最投票回答修改host文件我已經改變了我的網站名稱未住域,但在我的本地域名所有堆棧溢出的解決方案仍然無法FB登錄我的本地主機服務器

127.0.0.1  localhost 
127.0.0.1  localhost/great 

後後這個我做了測試應用還fbdevelopers和變更域名到本地主機

enter image description here

並在此之後我有意見直播服務器上運行的應用程序的所有FB登錄碼和整合FB登入碼

function statusChangeCallback(response) { 
    alert("yes"); 
    console.log('statusChangeCallback'); 
    console.log(response); 


    if (response.status === 'connected') { 
     // Logged into your app and Facebook. 
     testAPI(); 
    } else { 

     document.getElementById('status').innerHTML = 'Please log ' + 
     'into this app.'; 
    } 
    } 


    function checkLoginState() { 
    alert("here"); 
    FB.getLoginStatus(function(response) { 
     statusChangeCallback(response); 
    }); 
    } 
    window.fbAsyncInit = function() { 
    alert("ghhh"); 
    FB.init({ 
     appId  : '1726174127690844', 
     xfbml  : true, 
     version : 'v2.10' 
    }); 
    FB.AppEvents.logPageView(); 
    }; 


    FB.getLoginStatus(function(response) { 
    statusChangeCallback(response); 
    }); 

    }; 


    (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 testAPI() { 
    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 + '!'; 
    }); 
    } 

和FB登錄

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

的按鈕,但仍然收到錯誤

Can't Load URL: The domain of this URL isn't included in the app's domain 

請天才在那裏我錯了就糾正我,請您給我您的專家意見

+0

嘗試使用「127.0.0.1 mytestdomain .com「,並在fb應用域上使用mytestdomain.com域 –

+0

您要我編輯主機文件並將其更改爲great.com – qasu

+0

是的,您應該在主機文件」127.0.0.1 great.com「中添加另一行,您的網站將可以在great.com/great(如果它在偉大的文件夾中) –

回答

0

您應該添加新的臨時域或使用您的實時網站域,而您在本地主機上爲您開發它時[R本地主機像

127.0.0.1  yoursitedomain.com 

,並使用yoursitedomain.com爲FB應用程序域 這樣FB是不會拒絕的域,你將能夠從本地主機實現它太

+0

但先生在fb應用程序域他們不接受這個網址 – qasu

+0

你可以試試你的活網站域然後,這是一個你應該如何解決問題的例子。 –

+0

先生我沒有訪問多數民衆贊成的原因,我想在我的本地服務器上運行fb登錄,並在現場它運行完美 – qasu

相關問題