asp.net – Facebook应用程序仅适用于管理员.为什么?
发布时间:2020-12-16 09:39:01 所属栏目:asp.Net 来源:网络整理
导读:我创建了一个Facebook应用程序.在我的网站上,用户可以使用他们的Facebook帐户登录.一旦他们成功登录,我使用的facebook javascript API将在用户的新许可的情况下将URL发布给他们. 问题是,当我使用我的帐户从网站登录时,这是完美的工作,我可以在我的新闻源中看
我创建了一个Facebook应用程序.在我的网站上,用户可以使用他们的Facebook帐户登录.一旦他们成功登录,我使用的facebook
javascript API将在用户的新许可的情况下将URL发布给他们.
问题是,当我使用我的帐户从网站登录时,这是完美的工作,我可以在我的新闻源中看到帖子. 与其他人帐户登录时,他们的新闻源中不会显示该帖子. 注意:我是facebook app的唯一管理员,Sandbox模式被禁用. 我需要进行任何设置,以便此功能适用于所有用户吗? 使用代码: //Get values from hidden field var appid = document.getElementById("appid").value; var message = document.getElementById("message").value; var link = document.getElementById("link").value; var name = document.getElementById("name").value; var picture = document.getElementById("picture").value; var description = document.getElementById("description").value; var Post_to_fb = document.getElementById("Post_to_fb").value; var Authenticated = ""; // Load the SDK Asynchronously (function (d) { 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.js"; ref.parentNode.insertBefore(js,ref); } (document)); //Init the SDK upon load window.fbAsyncInit = function () { FB.init({ appId: appid,// App ID channelUrl: '//' + window.location.hostname + '/channel',// Path to your Channel File status: true,// check login status cookie: true,// enable cookies to allow the server to access the session xfbml: true // parse XFBML }); // listen for and handle auth.statusChange events FB.Event.subscribe('auth.statusChange',function (response) { if (response.authResponse) { // user has auth'd your app and is logged into Facebook var uid = "http://graph.facebook.com/" + response.authResponse.userID + "/picture"; FB.api('/me',function (me) { document.getElementById('auth-displayname').innerHTML = me.name; document.getElementById('profileImg').src = uid; }) document.getElementById('auth-loggedout').style.display = 'none'; document.getElementById('auth-loggedin').style.display = 'block'; var e = document.getElementById("ctl00_cphRightControls_FaceBookPlugin_ddlSocialSwitch"); var Social_switch = e.options[e.selectedIndex].text; //Post to FB only if Social switch is ON if (Social_switch == "on") { //Post to FB only for Main URL and not when clicking the internal links if (Post_to_fb == "True") { var opts = { message: message,link: link,name: name,picture: picture,description: description }; FB.api('/me/feed','post',opts,function (response) { if (!response || response.error) { // alert('Posting error occured'); } else { // alert('Success - Post ID: ' + response.id); } }); } } } else { // user has not auth'd your app,or is not logged into Facebook document.getElementById('auth-loggedout').style.display = 'block'; document.getElementById('auth-loggedin').style.display = 'none'; } }); $("#auth-logoutlink").click(function () { FB.logout(function () { window.location.reload(); }); }); } 解决方法
在注销管理员帐户和开发帐户之间尝试清除Cookie,或者更好的方法是使用不同的浏览器进行测试(
chrome profiles非常适合)
facebook js sdk为用户创建的cookie(fbsr_ {APP_ID})会为下次用户登录的第一次加载而坚持下去,并且当在画布外使用时(例如在网站上)加载第一页加载的东西你提到过). Facebook在一个浏览器中使用多个帐户并不完全简化,开发人员经常如何使用它们.很有可能因为这样,它试图发布错误的用户并导致错误.没有更多信息,这是我最好的猜测. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- 如何使用APDU将PIN验证代码发送到智能卡 – 使用.NET
- asp.net c#的论坛软件,我可以整合到我的asp.net项目中吗?
- asp.net – 使用javascript和服务器端禁用/启用requiredFie
- asp.net-mvc – ASP .NET MVC保护控制器/动作
- asp.net-mvc – ASP.NET标识:在Azure网站上使用GeneratePa
- entity-framework-6 – 带有EF6的ASP.NET-5
- ASP.NET:在URL中隐藏查询字符串
- asp.net – IIS中的静态压缩不适用于htm,js文件
- asp.net – 在global.asax中设置的用户仅在下次请求后才可用
- asp.net-mvc – 什么时候应该在asp.net mvc 2中使用异步控制
推荐文章
站长推荐
热点阅读