facebook注册localhost失败

时间:2014-06-22 14:28:33

标签: javascript php facebook laravel localhost

我试图在我的localhost上使用facebook注册插件。但问题是登记箱不会出现。

以下是一些截图: https://dyp.im/FXwee52OJC

https://dyp.im/NRjFe2ulB9

这是我的代码:

<!DOCTYPE html>
<html>
    <head>
        <title>Facebook Login JavaScript Example</title>
        <meta charset="UTF-8">
    </head>
    <body>
        <div id="fb-root"></div>
        <script>


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




            };

            // 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 = "//connect.facebook.net/en_US/sdk.js";
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));

        </script>

<fb:registration redirect_uri="http://www.google.com" />
test

</body>
</html>

1 个答案:

答案 0 :(得分:0)

请参阅Documentation,Facebook要求redirect_uri位于您自己的网站中:

  

redirect_uri:将处理signed_request的URI。它必须以您在应用信息中心中定义的网站网址为前缀。此字段是必填字段。

因此您需要将注册标记更改为以下内容:

<fb:registration redirect_uri="http://localhost/callback-fb-registered" />