gpt4 book ai didi

javascript - Facebook API 运行不佳

转载 作者:行者123 更新时间:2023-12-02 17:19:24 25 4
gpt4 key购买 nike

刚刚尝试使用 Facebook JavaScript API 在 html 页面中嵌入登录按钮

<body>

<div id="fb-root"></div>
<script>(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/fr_FR/sdk.js#xfbml=1&appId=637150723035739&version=v2.0";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

<div class="fb-login-button" data-max-rows="1" data-size="medium" data-show-faces="false" data-auto-logout-link="false"></div>

</body>

我什么也没得到作为输出我不知道我做错了什么

最佳答案

Facebook/Google 登录 API 需要特定的应用程序 Domain您的应用程序应从中调用 FB API 函数。如果没有,它就不会像您的情况那样工作。

来自Aknurm.com :

All you need is, a Facebook account and WAMP server running on your PC. Steps are quite simple.

Enable curl extension

By default on WAMP curl is disabled. In order to communicate with Facebook server you need to enable it. All you have to do is, Start your WAMP server then (left) click on green WAMP icon from system tray, navigate to PHP then PHP extensions and then check php_curl. You might need to restart your WAMP server to take effect.

Create a folder for your app on your PC. = Once you are done with enabling curls, you need to create a folder on your PC for your Facebook app. You can choose any name for it. In simple, create a new folder named fb inside your www folder of WAMP server. Then test it by navigating http://localhost/fb . You must see all your app content here.

Create app on Facebook

Once you are done with above two steps, you are now ready to create an app on Facebook. Just navigate to Facebook developer’s website and then from apps menu select Create New App.

Then Facebook will ask you for basic information about your app. You can choose any desired name and email address but you have to fill localhost as App Domain and http://localhost/fb as Website with
Facebook login
. This will enable login from localhost.

enter image description here

关于javascript - Facebook API 运行不佳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24101304/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com