fb app post on users wall - facebook

How to make a fb application that operates like this:
When a user visites a page of MY website ex. http://www.mywebsite.com/page1.php it will request the user to confirm the Facebook Application to make able the content of page, and then the application will post on users wall the page that the user visited on my page !?
Any idea, any script, any everything, I dont know how to even start it.

First, when the user enters your website ask him to login with facebook (ref: login).
After the successful authorization, simply use the Feed Dialog and post the link to current page on his wall.

Related

C# Facebook sdk: posting on page on owner's behalf

I have a page on facebook and i want to get my page access token so that i could use it to post ob my page from a mobile application or web application using the facebook sdk for C#.
I think the whole idea would be:
user will go to my webpage.
user will then login to facebook.
user will be taken back to my page with the his page's access token.
i will save this access token and then use it to post on his page on his behalf.
Right now i am not sure whether these are the right steps or not and if i am right, how can i make a facebook login page where user can use?
EDIT:
I found some answer here: Programatically log in to facebook and post from server side
do i need to create a facebook app for that?

How to post message on facebook page via a user

I have an facebook application in my website. i want to publish a user's profile link and some other stuff to my facebook page automatically. But currently this is being posted via page admin not user. How i can fix it?

how to make "uploaded via" link at the bottom of the post to link to user's website?

what I need: upload photos to user's fan page as a page, using an app for that
what I have: my website which does uploading, and a user, who created fan page and application, and that app's id and secret
what I do:
call FB.init() with that appId
call FB.login() with manage_pages,publish_stream permissions - this prompts FB login popup where user is asked to login and then to authenticate the app. As the result I get app access token.
Send request to https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=fb_exchange_token&fb_exchange_token=TOKEN_FROM_ABOVE to get extended app token valid for 2 months (and therefore page tokens will be extended as well as described here)
Send request to https://graph.facebook.com/me/accounts?access_token=TOKEN_FROM_ABOVE to get a list of pages user manages, and let user to choose the page he wants to publish to.
That gives me PAGE access token I can use to publish photos to user's FAN page using /albumId/photos/ API call.
what is the problem:
the "via" link in the photo redirects user to MY website (where user has authenticated his app to upload to his page):
that is because I had to ask user to enter my website's URL in app settings, otherwise Facebook login dialog will complain:
SO MY QUESTIONS ARE:
Am I doing this right? am I missing something probably?
If I am - then how can I get that "via" link to link to user's website?
Thank you.
how can I get that "via" link to link to user's website?
Not at all, because this always links to the app that was used making a post/upload.
What you could try though is having your website redirect when a user is coming to your site from Facebook. Which post/feed story the user is coming from should be passed to your site as parameters; then you’d only have to figure out which user made that post (look it up in your database), and redirect to their homepage.
I ended up adding client's website URL as a query string parameter into "Site URL" field in the application settings - and then I need to modify my site's backend to do redirects:
http://mysite.com/?redirect=http://client-site.com

Facebook Permissions Dialog in Page

I've created an app that works fine, however if the user has not authorized my app yet, they have to do the following (assuming they are in facebook AND logged in) -
go to my app
click login/authorize
popup with facebook permissions opens
accept in the popup
However I noticed with Zynga games like Mafia Wars 1/2, Farmville etc, when you go to the app, if it hasn't been authorized, it takes you straight to the permissions which is in a PAGE and not a popup, thereby eliminating one step. Also, the permissions dialog is full width, there is not app sidebar.
Does anyone know how I can duplicate this flow? It would be much easier to have users authorize within a facebook page rather than through a popup. How can I get permissions inside the page?
thanks in advance
Once user visit a Page tab with your application you can check if he is connected with your application by comparing Page ID with User ID in signed_requests, for unauthorized users ID's will be same. In that case you can start authentication flow by redirecting user's browser to "login url".
If you want it to be full page just do the redirect with JavaScript like this:
window.top.location = 'https://www.facebook.com/dialog/oauth?
client_id=YOUR_APP_ID&redirect_uri=YOUR_URL&scope=COMA_SEPARATED_PERMISSIONS'
If you using PHP you can construct Login URL by calling Facebook->getLoginUrl method.
Read the docs on Facebook authentication

facebook auto post

I want to develop a facebook application that make auto post to a facebook page
like this one http://apps.facebook.com/twitter/ but my application get post from other site
when user make a post in my site it will send to the facebook page even this user not loged in facebook or not page admin .
tnx for help
Yes, you can do this. You'll need to do an initial login to facebook through a webservice and request elevated rights (publish_stream and offline_access), and then save the authentication token that comes back. You can then reuse this token and post to a facebook wall without anyone having to explicitly login to facebook.
I did this using Hammock to create the webservice calls to facebook.