I'm developing a referral application where users can refer their Facebook friends using a referral code. I'm using Facebook Javascript SDK. The problem I'm facing is that the send method works only for particular URLs, I mean if I change the users referral token in link parameter it gives me error 100 invalid link.
Here is the method :
FB.init({appId: app_id, xfbml: true, cookie: true});
FB.ui({
to : '********',
method: 'send',
name: 'Message',
link: 'example.com/emp?token=fAiS1ywL0lS8cUYtgLjk',
redirect_uri:'http://example.com'
});
For some particular link values it works fine but if the token is changed it fails with invalid link error.
I'm stuck with fixing this issue. Am I missing something?
Duplicate of Facebook FB.ui send dialog intermittently returns invalid link error.
For your second question related to the og:url meta, to simplify you have to provide the URL of the current page.
The Open Graph Protocol says:
og:url - The canonical URL of your object that will be used as its
permanent ID in the graph, e.g.,
"http://www.imdb.com/title/tt0117500/".
To understand how those metas work you can check how News websites implement this with the Facebook Object Debugger.
For example this link shows you the implemention of metas for a well-known newspaper website.
Related
I have created a Facebook Application which will be used as a Facebook Tab Page. My problem is that I am unable to get the page id.
I want to use this single application for multiple Facebook Page Tabs but the content will vary based on the Page Id.
The code I am trying to use to get the signed_request is using the JavaScript SDK.
FB.getLoginStatus(function(response) {
console.log(response);
})
This can be done with the signed_request parameter, which is passed on to your URL.
The easiest solution is to use the PHP SDK. It offers a function called "getSignedRequest": https://developers.facebook.com/docs/reference/php/facebook-getSignedRequest
Those are the fields of the signed_request parameter: https://developers.facebook.com/docs/reference/login/signed-request
If you donĀ“t want to use the PHP, you need to parse the parameter on your own. Check out this link for more information and search for "Parsing the Signed Request": https://developers.facebook.com/docs/facebook-login/using-login-with-games
Edit: you will not get the correct signed_request using the JavaScript SDK. Use PHP (or your server language) for this.
The mistake was that the URL added in the Facebook page tab settings was getting redirected as it did not have a "/"; there was a redirect for SEO added and the URL in the Facebook APP sittings did not have the "/".
So as it was getting redirected Facebook sent the POST variable but we have not handled it. Now it is fixed.
Special thanks to #luschn and #Fran Barbero for all your efforts in this.
Sharing facebook photo (really a facebook photo) using mobile web app & Feed Dialog.
The problem: Cannot send facebook's photo to the Feed Dialog.
All code works great. I get all properties as they sent to the function.
FB.ui
method: "feed"
link: 'url'
app_id: myAppID
name: 'photo's name'
description: ''
caption: $('#albumName').text()
picture: 'http://myUrl.com/logo.png'
, (response) ->
if response and response.post_id
console.log 'Photo was shared'
else
console.log 'Photo was not shared. Please try again'
If I place a static photo, to represent the Picture parameter, all goes fine, But if I try to call a facebook picture I try to share, then I get a 500 server error.
GET
https://www.facebook.com/dialog/feed?access_token=...662390597_s.jpg&sdk=joey
500 (OK)
This is totally bizarre. The URL that goes to the dialog iframe, goes with all the needed parameters, including access_token.
It seems like a design issue. Like someone in facebook don't want us to pretend to be facebook when we customly share things using their feed dialog, when we share facebook photos.
Am I right?
* Problem Solved. See my answer below *
!!! Problem Solved !!!
Facebook don't accept their own CDN as a source. We need to bypass that in order to share, therefore we can reshare a facebook the photo using a proxy.
http://images.weserv.nl does the job. Facebook accept the image as a picture param, and this way you are able to reshare their posts.
Usage example (plus width and hight to improve performance)
'https://images.weserv.nl/?url=' + facebookImageUrl + '&h=200&w=200'
I can't share facebook photo use this example
when i share with (fb.ui method feed) i get 404 error on this link
https://fbexternal-a.akamaihd.net/app_full_proxy.php?app=460125687444228&v=1&size=z&cksum=047536ba625482c9b5343f2eb94a7039&src=https%3A%2F%2Fimages.weserv.nl%2F%3Furl%3Dhttps%253A%252F%252Ffbcdn-sphotos-b-a.akamaihd.net%252Fhphotos-ak-ash4%252Ft1.0-9%252F10157304_1383818341898181_8685912667835736794_n.jpg%26h%3D200%26w%3D200"
"app=460125687444228
cksum=047536ba625482c9b5343f2eb94a7039
size=z
src=https://images.weserv.nl/?url=https%3A%2F%2Ffbcdn-sphotos-b-a.akamaihd.net%2Fhphotos-ak-ash4%2Ft1.0-9%2F10157304_1383818341898181_8685912667835736794_n.jpg&h=200&w=200
v=1"
Where my error ?
I'm using the Facebook send dialog to send links to Facebook posts. But I get the following error back from the Facebook API:
API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.
This is the JavaScript:
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
// assume we are already logged in
FB.init({appId: '569858063028330'});
FB.ui({
method: 'send',
link: 'https://www.facebook.com/benjerryuk/posts/10151500944440101'
});
</script>
You can run it here:
http://jsbin.com/welcome/62834/edit
Facebook send dialog documentation: https://developers.facebook.com/docs/reference/dialogs/send/
I couldn't find it written specifically, but from my attempts it seems that facebook does not accept links to itself for some reason - I can't confirm this, but I got the same result even when I put links of public posts or profiles.
You might have the link refer to your app, which will redirect to the correct facebook post.
Another note: while showing this dialog, facebook loads the given link with AJAX, which means that A) it must be an active URL and B) you cannot use localhost.
Hope that helps.
I'v developed a Facebook tab in PHP and it pulls al the content from my web server.
When I try to post on a users wall using the following javascript code
FB.ui(
{
method: 'stream.publish',
name: 'Foo Bar',
picture: 'https://www.foobar.com/fb/img/pic_small.png',
caption: 'Caption',
description: 'Decription',
message: 'Message',
},
Facebook responds with the following error
API Error Code: 191
API Error Description: The specified URL is not owned by the application
Error Message: redirect_uri is not owned by the application
I found that one way to avoid this error is to register the tab as App on Facebook
and provide the Canvas URL and the Secure Canvas URL.
But what if I don't want the tab has an apps.facebook.com/appname entry url
I mean that what I want is just a FB Tab and not an app.Are there any other alternatives to post on users wall but of course using the standard fb Dialog Box ?
Thank you in advance for your time and for any help
I think that you are using old-fashioned FB.ui method type. Please, check the method 'feed'.
http://developers.facebook.com/docs/reference/dialogs/feed/
BTW, how about checking 'App Domain' setting or 'Website' setting. I also had a similar symptom a few weeks ago, then I just set the App Domain and Website URL as my domain. Yes, I know, it's very tricky ;)
I'm creating a facebook dialog here that links to an external site (not from my domain). In the preview the link shows up correctly, but when the message is viewed in the inbox the url has been changed.
Specifically, I call this function:
var link = "http://someexternalsite.com/?id=xxx"
var desc = "a description"
FB.ui(
{
method: 'send',
name: 'title',
link: link,
picture: 'http://mysite.com/somepicture.jpg',
description: desc
},
function(response) {}
)
And the link changes (when viewed in your facebook inbox) to
http://facebook.com/someexternalsite
Is there some unwritten security policy somewhere? Do I need to get permission from someexternalsite.com to link to their site?
Facebook keeps control of the links that are posted. That way if a link is to a virus or a malicious site, Facebook just needs to change their URL.
It seems that facebook take the meta og: property.
I didn't find a way to get the link I wanted without changing the og:url.
Btw the picture is also erase by the og:image tag.