1Ma*_*yur 61 configuration facebook-javascript-sdk facebook-social-plugins
我在我的html页面中使用过这个...
<script>
window.fbAsyncInit = function() {
// init the FB JS SDK
FB.init({
appId : 'xxxxxxxxxxxxxx', // App ID from the App Dashboard
status : true, // check the login status upon init?
cookie : true, // set sessions cookies to allow your server to access the session?
xfbml : true // parse XFBML tags on this page?
});
// Additional initialization code such as adding Event Listeners goes here
};
// Load the SDK's source Asynchronously
// Note that the debug version is being actively developed and might
// contain some type checks that are overly strict.
// Please report such bugs using the bugs tool.
(function(d, debug){
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" + (debug ? "/debug" : "") + ".js";
ref.parentNode.insertBefore(js, ref);
}(document, /*debug*/ false));
function shareOnFb(action, msg){
FB.ui({
method: action,
message: msg
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
当我尝试调用任何FB方法时,它会在我的控制台中说出来
应用程序配置不允许使用URL:应用程序的设置不允许使用一个或多个给定的URL.它必须与网站URL或Canvas URL匹配,或者域必须是其中一个Apps域的子域.
这是我的fb app设置..我需要在这里改变一些东西,暂时在本地运行我的网站,所以我尝试添加
localhost/OfferDrive /到此页面上的应用程序域,但它说错误,它不是一个有效的域
Anv*_*ena 60
你需要填充Facebook登录网站的值,http://localhost/OfferDrive/
以允许Facebook验证来自JavaScript SDK的请求来自正确的地方
mun*_*llj 44
更新Anvesh Saxena的答案(正确但过时,因为FB App界面已更改):
在您的FB App配置中,您需要添加一个网站平台,其中包含您网站的URL集.然后,您可以添加我设置到我们网站的基本域的应用程序域(例如,对于像这样的URL http://www.mycoolwebsite.com
,只需使用mycoolwebsite.com
).
重要提示:为了实现此目的,您需要使用应用程序URL的子域进行本地开发.您可以通过修改开发计算机上的hosts文件来轻松地执行此操作,以使用您网站中不存在的子域,例如local.mycoolwebsite.com
.如果您不熟悉如何执行此操作,只需为您的平台(例如mac/windows)谷歌"编辑主机文件".
Dan*_*ald 18
设置 - >高级,将网址添加到"有效的OAuth重定向URI".这适合我.
My Apps
并从下拉列表中选择您的应用程序.App Setting > Basic Tab
然后单击底部的"添加平台".Site URL
(例如mywebsite.com
)登录http://localhost:8080/myfbsampleapp
http://localhost:8080/myfbsampleapp
归档时间: |
|
查看次数: |
128165 次 |
最近记录: |