Obtaining Facebook Page token via Facebook Graph Explorer? - facebook

I am trying to follow the steps on this page but using the Graph Explorer instead: http://aseriesoftubes.com/articles/obtaining-facebook-page-access-tokens-the-4-step-program/
Can someone help with steps in getting a permenant Page Token from the Graph Explorer? Some posts are outdated and referring to offline access. Thanks for any help or advice.

This article is correct, i just tested it: http://www.devils-heaven.com/facebook-access-tokens/
See "Extended Page Access Token" in the article: Basically you have to authorize yourself with the "manage_pages" permission, then you need to extend your User Access Token, and with that Token you make a call to /me/accounts to get the Extended Page Access Tokens for all your pages.

STEPS FOR LASTING PAGE ACCESS TOKEN
1- You have to get page access token for a user by this API:
https://graph.facebook.com/{User-id}/accounts?access_token={access-token}
2- Then u have to refresh the save token by below API which will last for 60 days:
https://graph.facebook.com/oauth/access_token?client_id={your-client-id}&client_secret={client-secret}&grant_type=fb_exchange_token&fb_exchange_token={previous-access-token}

Related

facebook permernant access token user_posts?

I have no idea about how facebook tokens or APIs work, so please excuse my ignorance.
I am trying to get a access token to display my posts to my wall. My website is www.quadscene.co.nz and on the homepage I am trying to display all posts to wall.
I have created a access token using some tools within facebook, but they expire within about 2 hours, these token work fine when selecting the user_posts option or permission, however all other access tokens ive tried do not display posts.
I think its using OAuth.
Is there a way to create a token that will not expire? and has the user_posts permissions?
Thanks in advance!
You need to read the docs to understand how OAuth works and what different access tokens are available.
Specifically, you need to look at the long-lived tokens.

How to find the rating of facebook Page using C#

As per facebook API documentation we can get Facebook Page ratings using "/{page_id}/ratings". For this we need page access token.
https://developers.facebook.com/docs/graph-api/reference/v2.0/page/ratings
How can I get Page Access Token from facebook application.
Please help me.
Thanks,
You can use the
/me/accounts
endpoint as described here:https://developers.facebook.com/docs/graph-api/reference/v2.0/user/accounts/
Be sure to grant the manage_pages permission. Try it
https://developers.facebook.com/tools/explorer/?method=GET&path=me%2Faccounts&version=v2.0
Furthermore, I'd recommend to exchange the short-lived token from the last step to a long-lived one (60 days) as described here: https://developers.facebook.com/docs/facebook-login/access-tokens/#extending

Facebook Page Access Token can be used to post stuff?

I have read some introduction about Facebook's access token on http://www.devils-heaven.com/facebook-access-tokens/
What I want to ask is that can the page access token of Facebook be used as a permanent token if I just want to post something on the wall like user access token?
First of all don't ever follow the third-party documentation for the facebook integration. They have the official documentation pls follow that. For access tokens read here.
What I want to ask is that can the page access token of Facebook be used as a permanent token if I just want to post something on the wall like user access token?
Its actually a vague question. It depends on what kind of posting you want to do. For eg:
If you want to post on a user's wall- there's nothing that a page access token can do
If you want to post a user's group/event etc. wall, again page access token has nothing to do with it.
If you want to post on a page, then yes you have to use the page access token in order to post on behalf of page itself.
Page access tokens are used in Graph API calls to manage Facebook Pages. 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
You can also extend a page access token that will never expire. See here how to do that!

Facebook page: Permission update

I had an unknown permission exception when I tried to update/create/delete or doing anything my Page properties by using FB.api . I tried again by using Graph API Explore but it still gave me same error. I used google for 2 days but there wasn't any correct answer.
Below screenshot is my app Settings in the Adminster Page's account:
http://demos.kksolution.com/Facebook/screenshot/post-update-about-page.jpg
And here is the Graph API Expore screenshots:
demos.kksolution.com/Facebook/screenshot/list-pages.jpg
Next is the error:
demos.kksolution.com/Facebook/screenshot/post-update-about-page.jpg
Please help me. Thanks too much.
You need a page access token.
Page Access Token – These access tokens are similar to user access
tokens, except that they provide permission to APIs that read, write
or modify the data belonging to a Facebook Page. To obtain a page
access token you need to start by obtaining a user access token and
asking for the manage_pages permission. Once you have the user access
token you then get the page access token via the Graph API.
Doc: https://developers.facebook.com/docs/facebook-login/access-tokens/
Then use GET /me/accounts to get the access token associated to your page.

How to get permanent access token in graph API

I created an APP on Facebook and using graph API explorer, I selected my app from app drop down box, requested access token with manage_pages, offline_access and publish_stream permissions.
Using this access token, I was successfully able to post message on page using restfb APIs but when I log out, it starts throwing The session is invalid error.
I read on few posts that offline_access is deprecated. Could someone tell me how to obtain permanent access token?
Thanks
Looking at the docs at: https://developers.facebook.com/roadmap/offline-access-removal/ this is no longer possible.
Desktop applications will not be able to extend the life of an
existing access_token and the user must login to facebook once the
token has expired.
Otherwise, it is possible to request an access token with a longer expiration. Here are the directions: https://developers.facebook.com/roadmap/offline-access-removal/#extend_token
What kind of Access Token do you need? There are three kinds, User AT, App AT and Page AT.
If you want User AT, it seems you are out of luck. I don't think it's possible anymore. You can only get to 60 days. However, if you need Page AT, you can get a permanent one. The difference is, Page Access Token only has access to a single facebook page.
Basically you need to get User Access Token first, with manage_pages permission. When you have one, you have to look at /{pageId}?fields=access_token for your page's id in Graph API.
For more info look at: facebook: permanent Page Access Token?
you will not get any permanent access token as Facebook developer blog explains. you will be given 60 days long lived access token. Before the expiration Facebook will notify you about the expiry and then you can renew it or you can build your own custom control to get the notification on token expiration which you can fetch from Facebook API.