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

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?

Related

Do review required if we want to get Facebook Page like count (Without Facebook login) by Facebook app token?

I am doing a static web page in my website, in which I am showing the like count of particular Facebook page. There is no kind of login required to see this web page. Also, I don't want to user to login with their Facebook account to see the Facebook page like count.
I have implemented this requirement by using Facebook app token.
API: "https://graph.facebook.com/PAGE_ID?access_token=APP_TOKEN"
But the problem here is, If I use the app token of already approved app by Facebook with some permissions (manage_pages) exists, it works. It is not working for the app token of newly created Facebook app.
I have sent the app for review to Facebook by requesting manage_pages permission, but they rejected the app and said that my website doesn't have the Facebook login functionality implemented.
Since it is not documented clearly, I have a doubt that do the app need to send for review if I want to get the Facebook page like count without Facebook login (By using Facebook app token)? If yes, what permission do I want to request?
Any help would be much appreciated.
First of all, you need to learn what Tokens there are:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
For your problem, you can just use an App Access Token. There is no need for any permission or Login Review, the links above tell you exactly how to create one. Make sure you never use the Token on the client, especially because it includes the App Secret. Do the API call on the server only (file_get_contents or curl, if you use PHP).
If by "it does not work" you mean that you only get the id and the name, then it´s not about "not working", you need to read the changelog and search for "Declarative Fields": https://developers.facebook.com/docs/apps/changelog#v2_4
So if you want to get more than just id and name, the API call would be like this: https://graph.facebook.com/936299239766048?access_token=YOURAPPTOKEN&fields=id,name,likes,...

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

What method does Pinterest use for Facebook login? Registration plugin?

If you go to login on Pinterest, 2 big buttons appear, one for Facebook, one for Twitter. I am confused about how the Facebook one works, compared to the Facebook Registration Plugin I have been trying.
On Pinterest, if you click the link you are logged into Facebook, it takes you right to your Pinterest account. When I set up the Facebook Registration Plugin on my own site, it says you are supposed to use an iframe, which loads a form for the user to fill out with whatever info you want from them. I am confused as to how I would just get the user to bypass this iframe on my site.
Pinterest uses server side OAuth to authenticate using Facebook.
Here's the documentation:
http://developers.facebook.com/docs/authentication/server-side/

Facebook request change according to different login

Will the facebook fetching a tab application differs according to different login?
If I am login as application admin or page admin then facebook fetches the application through POST and if i am login as a normal user, then facebook fetches the page through GET
As I know, Facebook integrate with your app (iframe) with only one method (i.e POST). Everything you put on app URL facebook will post to your iframe.
For example apps.facebook.com/your_app/id/1, Facebook will POST id=1 to your iframe.
However, you can check an user whether is an app/page admin or not by using Open Graph API:
http://developers.facebook.com/docs/reference/api/page/#admins
I think you question somehow relate to this:facebook application API check if user is application admin in facebook
Hope this will helps.

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.