I'm starting to get my Facebook integration working on my own app but I'm still strugling with one part:
create a callback URL of redirect URL after a successful video post on my facebook wall trough:
<form enctype="multipart/form-data" action="https://graph-video.facebook.com/v2.9/me/videos?source={{video_source}}&access_token={{access_token}}="POST">
<input name="file" type="file" value="">
<input type="submit" value="Upload" />
</form>
Does anyone know how to do this. So after a successfull upload redirect to a page in my app.
Thanks for helping me out.
Related
I have website where users can login with their Facebook account.
I am using javascript FB.login method to display Facebook login dialog. By default, it triggers displaying new popup window. Many users have forbidden popups in their browser. How to force facebook login dialog to be displayed in the same window where the user clicked on Login button?
I can see that it works on this website
When user click on Login button, he is redirected to facebook. After he login to FB, he is redirected back to the original website. Everything in the same browser tab.
See: https://developers.facebook.com/docs/reference/dialogs/oauth/
Rather than using the FB.login(), just add a link to your page like this:
LOGIN!
Facebook will then log the user in and redirect them back to your URL with some goodies on the querystring:
YOUR_REDIRECT_URI?
error_reason=user_denied
&error=access_denied
&error_description=The+user+denied+your+request.
&state=YOUR_STATE_VALUE
As per the Facebook documentation you can use display=page which will open in same browser window.
set display touch do the trick
example
form method="get" action="https://graph.facebook.com/oauth/authorize" id="openid_form">
<input type="hidden" value="" name="client_id" id="client_id"/>
<input type="hidden" value="touch" name="display" id="display"/>
<input type="hidden" value="http://www.mobileborg.com/modules/openid/fb_callbackuri.php" name="redirect_uri" id="redirect_uri"/>
<input type="hidden" value="email,read_stream,user_location,user_hometown,read_friendlists,user_photos,user_videos,publish_stream,offline_access" name="scope" id="scope"/>
<div style="display:block">
<input type="hidden" name="oid_name" id="oid_name"/>
<input type="hidden" size="40" class="openid-identifier" name="openid_identifier" id="openid_identifier"/>
<input type="submit" style="display:none" value="Login" id="submit-button"/>
</div>
</form
My problem was that I had the "External Links" module enabled. It saw the facebook url as external, and promptly added target="_blank", causing all clicks to open in a new window.
When publishing a post on the user's wall (via the graph API) I know how to change the privacy settings using the "privacy" field, and it works fine.
However, how do I do the same on a photo published into an album? Photos in albums also have privacy settings (you can set them manually so I guess you can set them via the API, or can't you?). The privacy field for the Photo object does not exist. I thought it may be undocumented so I tried it, but it doesn't work.
So how do I change the privacy settings for a photo? (ideally at the very moment of publishing it)
thanks
m.
From what I've seen you can't set a Photo's privacy directly when publishing (the API seems to only take "source" and "message" values).
However, if you create a new Album and pass in "visible" with a value of "everyone" then the album is "public".
<form action="https://graph.facebook.com/me/albums?access_token=<?= $fb_access_token ?>" method="POST">
Album name
<input name="name" type="text" value="Name of Album"><br/><br/>
Album message
<input name="message" type="text" value="Message on Album"><br/><br/>
Album visible level
<input name="visible" value="everyone" /><br/><br/>
<input type="submit" value="Create"/>
</form>
If you then upload a Photo into that album then the Photo will also be "public".
<form enctype="multipart/form-data" action="https://graph.facebook.com/[ALBUM_ID]/photos?access_token=<?= $fb_access_token ?>" method="POST">
Please choose a photo
<input name="source" type="file"><br/><br/>
Say something about this photo:
<input name="message" type="text" value=""><br/><br/>
<input type="submit" value="Upload"/>
</form>
To my knowledge the "visible" setting is undocumented... I found it in the FQL table: http://developers.facebook.com/docs/reference/fql/album/
You would think it accepted "privacy" but in my experience it does not. http://developers.facebook.com/docs/reference/api/album/
I just added a FBML application to my fan page but I can't make JS to work ... though I read the FBJS best practices ... I guess I am missing something.
here is the current code :
<form action="" method="post" target="_blank">
<input type="text" name="email" id="emailInput" onclick="document.getElementById(‘emailInput’).setTextValue(‘Hi!’);" value="votre adresse email" alt="Entrez votre email" />
<input type="hidden" name="place" value="facebook" />
<br/>
<input type="submit" name="submit" class="submitInput" value="" alt="Valider" />
</form>
The onclick event seems not to work but I can't get any answers from my research over Internet ...
Any help welcome ;)
Cheers guys.
Gotye.
Use Firebug or Chrome tools to verify that the id is actually emailInput, and that the Facebook FBML parser didn't append a prefix to the ID. But FBML pages have been deprecated so you will be better off switching to an iframe fan page so you aren't running the risk of having Facebook kill your FBML fan page. Also, javascript is a ton easier in iframe pages and can be called without having to wait for a click event to fire.
When I submit a form using method "POST" and full canvas callback Url action inside Facebook iframe canvas, I cannot get the form elements in the request.
Can anyone give me some help on this?
page code:
<form action="http://apps.facebook.com/myapp" method="post" target="_top">
<input type="hidden" name="myvar" value="v" />
<input type="submit" />
</form>
If i understood your question i think that
you are in an IFRAME... so why use a facebook url for the action?
simply put in the action parameter the url of your web application (not the facebook url, but the url of the canvas) something like http://www.yourhost.it/your_fb_app/process.php/aspx
hope this help (and hope to have understood your problem)
Our JBoss form is posting the parameters in the URL instead of in the request despite being a POST form. I have confirmed that the form is post in the actual page using Firebug. Note that this is within a portlet.
We are submitting the form using javascript like:
function submitForm(action, time)
{
document.getElementById("pageActionInputID").value = time;
document.getElementById("timeSpanFormInputID").value = action;
document.getElementById("formID").submit();
}
<form action="<portlet:actionURL></portlet:actionURL>" method="POST" id="formID">
<input type="hidden" name="pageAction" id="pageActionInputID" />
<input type="hidden" name="timeSpan" id="timeSpanFormInputID" />
</form>
where 'portlet' is from
<%# taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
Any ideas why we are getting the inputs in the URL?
Here is what the resulting markup looks like:
<form id="formID" method="post" action="/portal/auth/portal/myTab?action=1">
<input id="pageActionInputID" type="hidden" name="pageAction"/>
<input id="timeSpanFormInputID" type="hidden" name="timeSpan"/>
</form>
Though it would be great if someone could confirm it. I think the JBoss Portlet throws out post/get and uses action URLs instead.
A descriptive article about render and action URLs