Facebook Wall Post Error: OAuthException :: (# 1500) Invalid URL

I have a news web application that runs on Heroku. When users post news comments in my application, my application posts a comment to the facebook userโ€™s wall using fb_graph . Everything worked fine until a couple of weeks ago. For no reason that I can explain, I now see some strange behavior.

Now when the user submits a comment to the story, the FB API responds with OAuthException :: (#1500) The url you supplied is invalid . If, the same user then sends additional comments to the same story, these comments are sent to the FB user feed only fine.

I used the FB API API to confirm that I have valid access tokens and that my application really accepts messages in the FB feed token feed.

To make things even more incomprehensible, when I run my web application in development on a local host, all messages go very well for my FB development application.

 def post_to_facebook(story, post) auth = Authentication.find_by_provider_and_user_id("facebook", current_user.id) if auth me = FbGraph::User.me(auth.token) if me.permissions.include?(:publish_stream) begin me.feed!( :message => "#{best_name(current_user)} made the following post to NewsWick: #{post.contents}", :name => story.title, :link => "https://www.newswick.com/stories/"+story.id.to_s, :description => "Story posted to the NewsWick world-wide news service" , :picture => best_photo(story)[:photo_url] ) rescue => e @msg = "Facebook posting error: "+ e.to_s puts "Facebook feed posting error: #{e.message}" end else @msg = "No longer authorized to post to Facebook." end end return @msg end 

The last thing to note, the only thing I changed w / r / t, how my application interacts with FB in the last two weeks, was that I accepted FB July Breaking Changes .

Does anyone have any clues. This is infuriating me!

+7
source share
4 answers

I have the same problem, only the difference is that I use javascript api.

This seems to be a facebook bug already reported here: https://developers.facebook.com/bugs/136768399829531

+3
source

Yes, this is a known mistake, and the Facebook developers are studying it, so they say something interesting that I found out:

I send my Facebook using 2 methods using the RestFB API , firstly, for messages with URLs like www.something.com and without URLs, I realized last night that all messages without a URL work, and those that have a URL, i.e.

So, I changed my entire implementation to post to Facebook without using the link options for all posts, with or without links.

With the link Parameter - gives an error # 1500

 FacebookType publishMessageResponse = resftFBclient.publish(FACEBOOK_PAGE_ID +"/feed", FacebookType.class, Parameter.with("message", "Hello StackOverFlow!"), Parameter.with("link", "message with a link , www.me.com")); 

Without a link parameter - this works even if the message contains a URL / link

 FacebookType publishMessageResponse = resftFBclient.publish(FACEBOOK_PAGE_ID. + "/feed",FacebookType.class,Parameter.with("message", "My message")); 

This works even if the message contains a URL / link and creates a link to the FB. Maybe FB is trying to abandon the implementation of links and let us understand that the first works the same way as the implementation of links? What's the difference?

This is cruel!

Greetings

Babajide

+3
source

I tried to solve this problem with this problem, which seems to be happening for almost everyone. I am using the PHP SDK.

I noticed that he always returned this error the first time he tried to send a link. On the other hand, it has been successfully published.

In fact, I then checked the hacking for an error and tried again to send a message to the wall.

 $errorCount = 0; function postPicture($phrase) { try { $image = $_SESSION['photoLink']; $facebook->setFileUploadSupport(true); $response = $facebook->api( '/me/feed', 'post', array( 'message' => $phrase, 'picture' => 'http://mylink/pictures/facebook.png', 'link' => $image, 'caption' => 'My caption', 'description' => 'My description', 'type' => 'photo', 'name' => 'My name' ) ); echo 'Success'; } } catch (FacebookApiException $e) { // You really should check if this $error is #1500 before doing that. I didn't :) if($errorCount < 2) { postPicture($phrase); $errorCount++; } else { $e = str_replace('"', "", $e); $e = str_replace("'", "", $e); echo 'Error ' . $e; } } } 
0
source

To solve these problems, simply add these metadata tags to the page header section represented by the URL you want to split:

 <meta property="og:type" content="article" /> //or any other type like blog, website etc.... <meta property="og:url" content="your article url here" /> <meta property="og:title" content="your article title here" /> 

Good luck

0
source

All Articles