automatically posting on facebook with pagetab app - facebook

i have a facebook pagetab app this app is installted on pages where i'm not the admin.
Can i post on this pages with the app by using the facebook api.
Sorry for my bad english and thx for answers!

Since you are not the admin of the page, you can't publish to their page using your app! Since, to publish new posts on behalf of tat page, a page access token with publish_actions permission is required. (see more on this here)
And to generate a page access token, an admin of the page must grant an extended permission called manage_pages. Once this permission has been granted, you can retrieve the page access token using the following Graph API request:
GET /{user-id}/accounts
So only the admin could generate the page access token, and if you have that (of course with his perms :P), you can post on that page on its behalf!

Related

Facebook long lived Page Access Token

I am administrator of facebook page which DOES NOT have a classic facebook account assigned. So I am not able to create any facebook application as you can see in Picture 1. How can I obtain long lived (never expiring) page access token, which I need to use Graph API? I need to post messages to the facebook page from my server.
Thanks for advice
You do need a User account that is admin of the Facebook Page in order to get a Page Token. Without a User account, it is not possible.
HereĀ“s what you need to do:
Authorize the User account in the App - which means, get a User Access Token
Extend the User Token
Get an Extended Page Token with /me/accounts or /[page-id]?fields=access_token
Some Links for more information:
https://developers.facebook.com/docs/facebook-login/access-tokens/
http://www.devils-heaven.com/facebook-access-tokens/
http://www.devils-heaven.com/extended-page-access-tokens-curl/

How to post on facebook page as that page

Let's say I've create a facebook page named MyPage.
When I am using a web interface of FB, I can either post on that wall as the user I am logged in as (personal user) or as a page instance, MyPage user.
Is it possible, via any of the available API's, to post on a facebook page as that page's user programmtically from my desktop application code?
To post on facebook page as that page, you need an page access token of that page.
To get the page access token, you need-
permission: manage_pages.
API call: /{page-id}?fields=access token
(If you are not aware, you can test the graph api calls from: Graph API Explorer)
In the posting code, just add a parameter: access_token and give it the page access token. That's it.
PS if you wish to extend this token, that'll never expire, you can get the login from here: What are the Steps to getting a Long Lasting Token For Posting To a Facebook Fan Page from a Server

Facebook: Get access token to post as a page

Is it possible to somehow get an access token to use the facebook api like a user that clicked "use facebook as "?
What I'm trying to do is to allow my website to post messages to the facebook page's wall. I already have an app which I use to allow my users to login with their FB account. However, I'd prefer not to require a page admin to authorize full manage_pages to my app. I already added the app to my FB page, but there are no options to give that app some permissions for my page.
Of course it's possible.
In the official documentation page about Permissions it's written:
Page access_token
An access_token used to manage a page. This is used
when you want to perform an operation acting as a Page. This access
token is retrieved by issuing an HTTP GET to /USER_ID/accounts or to
/PAGE_ID?fields=access_token with the manage_pages permission. Getting
/USER_ID/accounts will return a list of Pages (including app profile
pages) to which the user has administrative access in addition to an
access_token for each Page. Alternatively, you can get a page access
token for a single, specific, page by issuing an HTTP GET to
/PAGE_ID?fields=access_token with the manage_pages permission (you
must ask for the access_token field specifically via the fields=
parameter). See the documentation for the Page object for more
information. NOTE: After November 1, 2011, manage_pages permission
will be required for all access to a user's pages via this connection,
i.e. for both reading the user's pages and also retrieving
access_tokens for those pages. See the documentation for the User
object for more information.

How do I get an auth token for a facebook page if my app has been added to it?

My app's only purpose is to make posts as Facebook pages, so we'd like to take user login out of the flow.
If the user adds our app to their page using a link like http://facebook.com/add.php?api_key=APP_KEY&pages=1, how would I get an access token to make posts as that page?
Thanks :)
At least one of the page's admins has to authorize your app with both manage_pages and publish_stream permissions. (see https://developers.facebook.com/docs/reference/api/permissions/)
Then once you get their access token, call the graph with me/accounts and in that list will be the page. (see the Page Login section of https://developers.facebook.com/docs/authentication/) In there will be a page access token for managing that page. So then you can HTTP Post to me/feed a new message using that page access token.
Happy coding!

How to use Facebook API to publish an event on a page after logging-in a user?

I used the graph api in order to connect the user and publish an event on its wall.
But if I am connected as a page, I get this error message : "You need to be connected as a user and not as a page to run this app"
But I which I could publish my event on a fan page.
Here is my TOKEN_URL
How shoud I do to be able to publish on my fan page.
How can I enable that ?
To publish "on behalf" of a Page, you need to use a Page access token. To get a Page access token, first get an access token for a user with the manage_pages and publish_stream permissions:
https://graph.facebook.com/oauth/authorize?client_id=YOUR_APP_ID&
redirect_uri=YOUR_REDIRECT&scope=manage_pages,publish_stream&type=user_agent
Then, using the access token you get as a result, do a GET of:
https://graph.facebook.com/me/accounts?access_token=ACCESS_TOKEN_FROM_STEP_1
Here, you'll find the list of the Pages the user is an admin of. Here you can grab the access token for one of these Pages. Now calls you make will be made on behalf of the Page. Now anything you try to post will be posted as the Page. If you are trying to create events, you may also need the create_event permission.
To see how this works, you can test this out using these URLs in your browser or in the Graph API Explorer.
You need to get an offline access token with the manage_pages permission for the user that created/owns the fan page. After obtaining the user's access token, then you need to get the page's access token.
See this answer with code for details:
How can I use 'manage_pages' permission with the SDK on Facebook?
You could log in as the administrator of the page and create an offline access token for that user.