简体   繁体   English

Facebook apprequest未被发送给Facebook用户

[英]Facebook apprequest not being sent to facebook users

I'm developing a web app integrated with facebook and I'm using the request dialog to invite new users. 我正在开发一个与facebook集成的网络应用程序,我正在使用请求对话框来邀请新用户。 So a user of my app can click on a button to send an apprequest to some of his facebook friends which are not users yet. 因此,我的应用程序的用户可以单击一个按钮,将请求发送给尚未成为用户的他的某些Facebook朋友。

exports = fm.namespace(this,'bla','facebook')

exports['init'] = function(){
  window.fbAsyncInit = function() {
    if (undefined !=RAILS_ENV['facebook_app_id'])
    {FB.init({
               appId      : RAILS_ENV['facebook_app_id'], // App ID
      status     : true, // check login status
      cookie     : true, // enable cookies to allow the server to access the session
      oauth      : true, // enable OAuth 2.0
      xfbml      : true  // parse XFBML
             });}
  };

  // Load the SDK Asynchronously
  (function(d){
    var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
    js = d.createElement('script'); js.id = id; js.async = true;
    js.src = "//connect.facebook.net/en_US/all.js";
    d.getElementsByTagName('head')[0].appendChild(js);
  }(document));
}
exports['sendRequestToOneRecipient']= function (uid) {
  FB.ui({method: 'apprequests',
    message: "bla bla",
    to: uid 
  }, requestCallback);

  function requestCallback(response) {
    if (response && response.to) {
      console.log("Message was sended"); 
    } else {
      console.log("Message was not sended.");
    }
  }
}

As far as I know it does not requiere any permissions because is a explicit action from the user. 据我所知,它不需要任何权限,因为它是来自用户的明确操作。 When a user clicks the button, the facebook window appears and everything is working fine. 当用户单击该按钮时,将显示Facebook窗口,一切正常。 The callback is sending back the appId and the userid of the destinatary but the message is never being notifified in facebook destinatary account 回调是发送回appId和destinatary的用户ID,但该消息永远不会在facebook destinatary帐户中被通知

No javascript errors on the console 控制台上没有JavaScript错误

Similary I'm posting to the wall of facebook friends and it is working without any issues. 我发布在Facebook朋友的墙上,它没有任何问题。 The same code but instead of 'apprequest', the method is 'feed' 相同的代码,但不是'apprequest',方法是'feed'

To solve the problem I've just marked my app as facebook application and added a canvas secure url, so when the user receives my apprequest it could be redirected to a valid site. 为了解决该问题,我刚刚将我的应用程序标记为facebook应用程序,并添加了画布安全URL,因此当用户收到我的请求时,可以将其重定向到有效站点。 As soon as I added that url, the users receive all the notifications. 一旦我添加了该url,用户就会收到所有通知。

The problem now, is that I have to create a specfic page to embeed as an iframe, because my website doesn't look proper as an iframe. 现在的问题是,我必须创建一个特定的页面来嵌入iframe,因为我的网站看起来不像iframe。 Also I have to adquire a ssl certificate because canvas url must be https. 此外,我必须获得ssl证书,因为canvas url必须是https。 If anyone knows a workaround, please let me know. 如果有人知道解决方法,请告诉我。

Thanks for your anwsers 谢谢你的帮助

Put the following in your template file: 将以下内容放入模板文件:

if (top.location != self.location)
{
    top.location = self.location
}

If the location of the main website you're on isn't the same as your website's location it redirects you to your website. 如果您所在的主要网站的位置与您网站的位置不同,则会将您重定向到您的网站。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM