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/
Related
I've been reading documentation and Stack Overflow link all morning, but I'm just not understanding the correct process to authorize a web server to post to a Facebook page wall.
What I'm not clear on is why I have to post to Facebook as a Facebook User, using an access_token, meaning that this user has to log into Facebook manually to authorize my app.
I'm not trying to authorize a User, nor any of my visitors to do anything with their accounts, so I don't need any permissions from them. Instead, I'm trying to authorize my Web Server to post updates to its wall as a specific Page.
Why do I have to use a user access_token to do this? I'm not attempting to impersonate the user, I'm trying to post to the page as the page...
Is it possible to authorize a user and get their access token without having to create a login page on the Web Server? I don't want to have to require the user to login to make this work, I thought that was the point of having an app ID and Secret?
I guess my question is this: Is it not possible to allow a web server to post to a Facebook page wall as that page, without having to present a login dialog to a specific user? If it is possible, what is the correct workflow to set this up?
In order to post to a Page as a Page, you have to use a Page Access Token. You get that with a User Access Token, and you can extend it so it will stay valid forever.
Steps:
Request a User Access Token with the manage_pages permission (valid for up to 2 hours)
Extend the User Access Token (valid for up to 60 days)
Get the Extended Page Access Token for your Page with the User Session
Store and User The Page Access Token in the publish call
It may sound a bit complicated, but there are many tutorials for this and you don´t actually need to program it, you can just use the Graph API Explorer.
Here are some Links about the Access Tokens:
https://developers.facebook.com/docs/facebook-login/access-tokens/
http://www.devils-heaven.com/facebook-access-tokens/ (see "Extended Page Access Token" for a step by step tutorial)
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!
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.
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!
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.