2

When I try to publish a custom action I am get an error (below) claiming that the URL representing my object is of type website. As you can see from my object html I have included a. og:type '{app_namespace}:{object_name}' tag, in fact this code was mostly generated by the developer app. I have successfully published custom actions in the past for other apps and I cannot figure out what is different this time. Any suggestions would be appreciated.

Facebook Error:

{"error":{"message":"(#3502) Object at URL {URL} has og:type of 'website'. The property 'issue' requires an object of og:type '{app_namespace}:{object_name}'. ","type":"OAuthException","code":3502}}

Object Html:

<html>
  <head prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb# {app_namespace}: http://ogp.me/ns/fb/{app_namespace}#">
    <meta property="og:type"   content="{app_namespace}:{object_name}" /> 
    <meta property="fb:app_id" content="{app_id}" /> 
    <meta property="og:url"    content={URL for this Html} /> 
    <meta property="og:title"  content="Sample title" /> 
    <meta property="og:image"  content="https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png" />
  </head>
<body>
</body>
</html>

Code I'm using to publish the action:

<head>
    <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
    <script type="text/javascript">
        function clickHandler() {
            FB.getLoginStatus(function (response) {
                if (response.authResponse) {
                    FB.api('/me/{app_namespace}:{action_name}?{object_name}={object_url}', 'post', function (response) {
                        alert(JSON.stringify(response));
                    });
                } else {
                    //If user not logged in initiate login process
                    FB.login(function (response) {

                        if (response.authResponse) {
                            FB.api('/me/{app_namespace}:{action_name}?{object_name}={object_url}', 'post', function (response) {
                                alert(JSON.stringify(response));
                            });
                            //actionPublish();
                        } else {
                            //user cancelled login or did not grant authorization
                        }
                    }, {
                        scope: 'publish_actions'
                    });
                }

            });
        }

        $(document).ready(function () {
            window.fbAsyncInit = function () {
                FB.init({
                    appId: '{app_id}',
                    status: true,
                    cookie: true,
                    xfbml: true,
                    oauth: true
                });

                // run once with current status and whenever the status changes
                FB.getLoginStatus(updateButton);
                FB.Event.subscribe('auth.statusChange', updateButton);
            };

            (function () {
                var e = document.createElement('script');
                e.async = true;
                e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
                $("#fb-root").append(e);
            }());
        });
    </script>
</head>

<body>
    <div id="fb-root"></div>
    <button id="publishButton" onclick=clickHandler(); return false " >Publish</button>
</body>

Edit:

If I paste the fb object URL into the debug tool I get the following error:

"There was an error in fetching the object at URL 'http://www.thepropagator.com/takeAction/draft_1/demos3/issue_4.php', or one of the the URLs specified via a redirect or the 'og:url' property including one of http://www.thepropagator/takeAction/draft_1/demos3/issue_4.php."

If I try blocking out the URL tag all together the error goes away, in either case when I try to publish an action Facebook sends back the error saying that the object is of type website.

Ben Pearce
  • 6,884
  • 18
  • 70
  • 127
  • Put your object’s URL through Facebook debug tool. – CBroe Jul 04 '12 at 10:45
  • [Facebook's Debug Tool](https://developers.facebook.com/tools/debug) will show you what Facebook is detecting for your URL - make sure you're providing valid metadata to the crawler (and not just to regular web browsers) and that you don't have an og:url or HTTP 301 redirect in palce – Igy Jul 04 '12 at 15:12
  • Hey guys I tried using the debug tool but am having trouble interpreting the results in terms of the error Facebook is sending back to me when I try to publish (See edit on question above). The URL I'm debugging is: http://www.thepropagator.com/takeAction/draft_1/demos3/issue_4.php – Ben Pearce Jul 04 '12 at 20:50

2 Answers2

0

See the top two responses to this thread.

This thread may also help you.

Or this one.

Other suggestions:

  1. The fb:app_id tag must match the app you're trying to use.
  2. Are you sure the og:url actually matches the objects URL? Maybe you have an og:url tag on the event page, which redirects facebook somewhere else that doesn't have the event's og tags.
  3. Have you used the same URL for an object in another app? That could also cause a problem. If your site requires a login that could also be an issue.
Community
  • 1
  • 1
Michael Frederick
  • 16,664
  • 3
  • 43
  • 58
0

I ended up creating a new Facebook app. That app had the same problem, but after tweaking it a little (both with the debugger and my code I started working. I'm not sure what the take away is here, but I believe that the problem may have had as many as three roots, bugs on my end, Facebook Caching and caching on my end.

Thanks to every one for their responses.

Ben Pearce
  • 6,884
  • 18
  • 70
  • 127