开发者

Facebook dialog appears but always says "An error has occurred"

开发者 https://www.devze.com 2023-01-31 04:09 出处:网络
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml">

...

<head>

...

<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
</head>
<body>
<div id="fb-root"></div>
<fb:like id="fb-like" href="http:开发者_运维技巧//www.example.com" layout="button_count" show_faces="false" width="100"></fb:like>

...

myscript.js:

FB.ui(
   {
     method: 'stream.publish',
     message: 'getting educated about Facebook Connect',
     attachment: {
       name: 'Connect',
       caption: 'The Facebook Connect JavaScript SDK',
       description: (
         'A small JavaScript library that allows you to harness ' +
         'the power of Facebook, bringing the user\'s identity, ' +
         'social graph and distribution power to your site.'
       ),
       href: 'http://github.com/facebook/connect-js'
     },
     action_links: [
       { text: 'Code', href: 'http://github.com/facebook/connect-js' }
     ],
     user_message_prompt: 'Share your thoughts about Connect'
   },
   function(response) {
     if (response && response.post_id) {
       alert('Post was published.');
     } else {
       alert('Post was not published.');
     }
   }
 );

I have Facebook like button on my page which works fine.

But when I call the FB.ui method above from my JavaScript source, the Facebook dialog pops up but displays this error message:

**An error occurred. Please try again later.**

This has happened repeatedly for two days since I started trying to implement it.

Not a very helpful error message.

Any idea what might cause it or how to narrow down the problem?


"This dialog is a replacement for the old www.facebook.com/connect/prompt_feed.php endpoint and www.facebook.com/connect/uiserver.php?method=stream.publish"

http://developers.facebook.com/docs/reference/dialogs/feed/

As you see, you're using deprecated stuff.


That it's deprecated doesn't matter, the issue is that you don't have permission to perform the action. Make sure your FB.login call requests publish_stream and it'll be fine.

I ran into an issue where the site logins were requesting this, but if the user wasn't logged into the site at this point it would do a


Have you registered the app with FB.int()? Info here

0

精彩评论

暂无评论...
验证码 换一张
取 消