Facebook Access Token for Pages
Solution 1
- Go to the Graph API Explorer
- Choose your app from the dropdown menu
- Click "Get Access Token"
- Choose the
manage_pages
permission (you may need theuser_events
permission too, not sure) - Now access the
me/accounts
connection and copy your page'saccess_token
- Click on your page's id
- Add the page's
access_token
to the GET fields - Call the connection you want (e.g.:
PAGE_ID/events
)
Solution 2
See here if you want to grant a Facebook App permanent access to a page (even when you / the app owner are logged out):
http://developers.facebook.com/docs/opengraph/using-app-tokens/
"An App Access Token does not expire unless you refresh the application secret through your app settings."
Solution 3
The documentation for this is good if not a little difficult to find.
Facebook Graph API - Page Tokens
After initializing node's fbgraph, you can run:
var facebookAccountID = yourAccountIdHere
graph
.setOptions(options)
.get(facebookAccountId + "/accounts", function(err, res) {
console.log(res);
});
and receive a JSON response with the token you want to grab, located at:
res.data[0].access_token
Rafael 'BSIDES' Pereira
Senior Frontend Web Developer for a very long time, design enthusiast, iOS development student and love to learn the new stuff. I prefer to work with JavaScript, HTML/CSS, React, Nextjs and tools alike - but I've been engaged in projects with Angular, AngularJS, Vue, React Native and so on. I give lots of value in contributing and safe environments to work. Also like to play games online, preferably MMORPGs. I made a tool to measure your DPS/HPS in ACT for FFXIV. If you understood all this line, check it out: H O R I Z O V E R L A Y
Updated on October 21, 2020Comments
-
Rafael 'BSIDES' Pereira over 3 years
I have a Facebook Page that I want to get some things from it. First thing are feeds and from what I read they are public (no need for access_token). But I want to also get the events... and they aren't public and need the access_token.
I don't want the user to login in Facebook or anything like that. I just want to push all the data I can from this only page. That's why I already discarded many examples I found here and the one at https://developers.facebook.com/blog/post/500/ , because they want the user to login or require some user action I'm not interessed.
What I want is that my Facebook Application have full authorization and access_token to push the data from this one Facebook Page that I own (admin). Is this possible? I already tried many things but nothing seems to work.
I tried clicking at this: https://www.facebook.com/dialog/oauth?client_id=150635421702954&redirect_uri=http://MY_URL/&scope=manage_pages&response_type=token&fields=access_token - changing MY_URL to my site's and it requests authorization to edit every page I own. Even not being what I want I clicked but had no access_token in return...
-
andresp over 11 yearsBy doing this I'm able to call connections on all my pages by using a page token of only one of them. Isn't this wrong? Is there a way to get a token for just one specific page that doesn't work on the other pages?
-
IMB over 11 yearsI've climb mountains and swim oceans just seek for this answer. Thank you.
-
coneybeare over 11 yearsThis process doesn't work anymore as the access token generated expires when you log out for whatever reason.
-
ifaour over 11 years@coneybeare, please refer to this document on how to extend the page access token
-
Sinan over 11 yearsThis does not help with getting events for a restricted page.
-
Keyur Mistry about 10 yearsI am not able to see the 3 rd point, that is (Get Access Token). So can you please tell me the process, to get token, and active it out.?
-
Max almost 10 yearsI keep getting an empty result. Does it make a difference if it is an app page?
-
Grzegorz over 9 yearsAs I wanted to say thank you I also want to add that this seems to be the only (at last one i found) way to obtain page access token.
-
GrantJ almost 9 yearsThis used to work for me but doesn't after April 30th.
-
ifaour almost 9 years@Tony, what doesn't work? what have you tried? and what do you want to achieve?
-
Antwan almost 9 yearsget a specific page public posts without user login using my app access token
-
ifaour almost 9 years@Tony, this should work for public posts, try this on cocacola/feed. Select your app from a dropdown, and then "Get App Token" and test.
-
almaruf almost 8 yearsI dont have a app for that page, so used a different add_id and secret with this pages auth token and got this "Invalid appsecret_proof provided in the API argument"
-
Nick Bondarenko over 7 years@ifaour tnanx a lot for your answer!
-
PHP Ninja over 6 yearsHi. can i add a page post with user access token who is admin of the page? please help me
-
jeromej about 6 yearsIs that still true?!
-
Amade about 6 yearsThere is a way to make the token never to expire. Check this answer for reference: stackoverflow.com/a/39182923/4171578
-
Jesse Novotny over 5 yearsSure, but how do I get ONE page's access token? At the moment, our app manages hundreds of pages. Using this method, we must make numerous requests until we get the access token for the right business.
-
albanx about 5 yearsThis does not work anymore, seems that there is not a way to publish to your own page with an api now.
-
Pedram almost 5 yearsAnyone have recently achieved this? I'm looking for this. Please help.
-
Aadam over 4 yearsI do not feel people are using facebook that much like before, any how they should provide simple solutions to access at least page likes
-
Masroor over 3 yearsa programmatic approach would have served better. This only helps for testing the API calls, but the real issue is how to do it with code.