Is it possible to use an uploaded file handle to upload to Facebook from the share dialog? - facebook

I have a photo sharing web application and one of my requirements is to add a way to quickly share a photo to Facebook.
I have looked at several ways to do this, and the one I like the most is to get an OAuth access token and redirect back to my site. Once they select the image they want to share, I then launch the share dialog window in an iframe:
https://www.facebook.com/dialog/share?app_id=[MY_APP_ID]&display=iframe&href=https%3A%2F%2Fexample.com%2Fsomepic.jpg&access_token=[TOKEN_FROM_OAUTH]
This all works fine, except it shares a LINK to the picture and doesn't actually upload the image and store on Facebook.
So, my next thought was to use my access_token and create an upload session. So, I first create the session at this endpoint:
POST https://graph.facebook.com/app/uploads?access_token=[MY_OAUTH_ACCESS_TOKEN]&file_type=image/jpeg
That returns a session id for me as I expect. I then upload the file through this endpoint:
POST https://graph.facebook.com/[SESSION_ID_FROM_PREVIOUS_STEP]?is_reusable=true&file_length=[BYTES_OF_IMAGE]&data=[IMAGE_DATA_BYTES]
The above all seems to work, and it returns me a "File Handle". Something that looks like this:
4::aW1hZ2UvanBlZw==:ARaQWknagoLiMi1rE4wzsPLLKoWuwj0hpx8Wyv9p7VX0cMvZ0c5qTESqW1qyeb-ejM-BsoIaHcy1DfkEGZhAAaN-7ShSffoRDEZn1kK1IJ00bA:e:1632539894:100624633370919:533575686:ARZVnrjRFvfvQcEYvbw
Now to the point of my question. Is it at all possible to somehow pass the above file handle to the dialog share iframe as opposed to passing it a URL? Something like this:
https://www.facebook.com/dialog/share?app_id=[MY_APP_ID]&display=iframe&attachment_id=4::aW1hZ2UvanBlZw==:ARaQWknagoLiMi1rE4wzsPLLKoWuwj0hpx8Wyv9p7VX0cMvZ0c5qTESqW1qyeb-ejM-BsoIaHcy1DfkEGZhAAaN-7ShSffoRDEZn1kK1IJ00bA:e:1632539894:100624633370919:533575686:ARZVnrjRFvfvQcEYvbw&access_token=[TOKEN_FROM_OAUTH]
I know that attachment_id doesn't work, but is there another way to do this?
It may not be possible, but would make it a cleaner solution that having a link to the images, which may end up changing...
Thanks!

My thoughts so far:
To Post a image with text to a Facebook Page i use this endpoint 'https://graph.facebook.com/{page-id}/photos?url={image-url}&message=your message'
This works fine but to get the {image-url} the image needs to be uploaded beforehand.

Related

Facebook take the wrong image on sharing. (Dynamic image generate for facebook robot)

I know there is a tons of questions about Facebook share... but trust me, I'm trying something different than the normal way of sharing.
Well, I have an Facebook image generate website, but I don't wanna to generate images every time an user enter. So its create an canvas, and then a "og:image" url with an ID..
Then when someone hit the share button, it open the Facebook UI, and:
-Facebook goes into the url with an ID.
-the php script check if the image is already created.
-if not, create the image and save it on amazon S3.
-an finally redirect to the S3 url.
The problem is, if I hit the share btn and post right after it has open... Facebook take an random image of the page.. its like he can't wait the processing and just give up o.o
Someone please know how to prevent it to happen?

Retrieve Facebook full name and picture from profile url

I'm trying to make a website with text input for facebook profile url and after procceeding, there should be user's name and profile image shown.
I saw something like that here: http://hackfbaccountlive.com/hack_account.php
(No, I'm not making another fb hack.)
I have been trying for a couple of hours now, and I always need to log in, and it's not working as I want.
Can you help me?
You should go into detail about what you're trying to do, as it sounds suspicious (please do not create a hack site). That being said, this all public information that can be fetched with the following calls:
https://graph.facebook.com/[user_id]
https://graph.facebook.com/[user_id]/picture
https://graph.facebook.com/[profile_username]
https://graph.facebook.com/[profile_username]/picture
You can then use either the UID or the profile username to create the profile URL, which is just https://www.facebook.com/[username_or_id]

Unity facebook SDK, can not post picture with FB.Feed

In my Unity IOS game, I am unsuccessfully trying to use FB.Feed to share a screenshot on the user's wall.
Facebook documentation uses FB.Api to publish the screenshot, but this method does not display a share dialog, it simply uploads the pic to Facebook.
Answers I have found so far:
Upload the picture using FB.Api, and then parse the FBResult for the picture URL, and feed that to FB.Feed Link to answer.
This method triggers an error, since it is not possible to use a Facebook URL as source for a picture.
Save the picture locally and prepend "File://" to the picture path. Link to question. This does not seem to work either, and the Facebook documentation does not seem to have any information on URL formatting.
My question:
Is this the correct (and only) way to display a share dialog when publishing a picture? Or am I looking in the wrong direction?
FB.Feed only allows you to post link to images. It doesn't upload the images to Facebook. Therefore, these images need to hosted somewhere on the net and not locally.
The best way to make it work is either upload the images to FB (with privacy property set to EVERYONE) using FB.API, and then share the link to that picture via FB.Feed. If you don't want to create duplicate stories, i.e. one from posting the picture and another from FB.Feed, make sure that you set no_story to true.

Share image including some attributes (e.g. description) on Facebook over web without app validation hassle

I want to share an image from a website on Facebook and pass some attributes (e.g. a description) to the status update, all done by clicking on a link.
A few months ago this worked fine using the sharer.php but by now this script just accepts a URL as parameter and scrapes the target site for Open Graph meta tags. This new approach isn't very helpfull if you just want to share elements on a page instead of the whole page.
Yeah, I could create an app and use the feed dialog to achieve my goal. But I honestly don't want to walk through the tedious app validation process just to share an image with some additional info!
So, does anyone know of a way to avoid this app hassle? Perhaps some undocumented parameters for the new implementation of the sharer.php?
There's no need for app validation - as #CBroe correctly stated! So the feed dialog IS an adequate solution!
Background: I assumed an app needs validation to go live. But I just didn't set up my app properly to make it available to every Facebook user.
See the comments to gloat over my stupidity. ;)

twitter hyperlink expand

I am working on Twitter Application, in it I get user tweets and if user share URL in it then it open in WebView.
But problem is that Twitter returns hyperlink like, http://t.co/eleekj4F.
I want to convert it in its original form as I have posted like http://www.abcd.com/testing.html
Twitter Developer See other similar threads also in the same forum.
Use expanded_url instead of url from returned entities.
I know there are some applications online that let you retrive the original url, you could maybe parse the response from them.
http://www.makeuseof.com/dir/untiny-extract-original-link-short-url/
I think you could also do it, by doing a http request to the short url and see what adress you are redirected to.