How to get facebook offline_access token? - facebook

How to get offline access token of facebook?
I know that from recently time is out of date. And if I can't get offline access tokens.
What solutions of this problem is?

If you want to get a fresh token, simply follow this guide. You can obtain it through the JavaScript SDK, or doing a request to Oauth. In both cases the user will not notice anything unless he de-authenticated your app.

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.

Facebook long-lived accesstoken for a page

I'm using a facebook extension in TYPO3 to pull out the facebook posts of a page. Therefor I need the accesstoken.
I googled around and found that I need a facebook app and I need to be administrator of the page.
Then I heard that I need to connet the app with the site, but how can I do this?
I also tried to get accesstoken:
https://graph.facebook.com/oauth/access_token?client_id=APP_ID&client_secret=APP_SECRET&grant_type=client_credentials
And then performing:
https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token& client_id={app-id}&client_secret={app-secret}&fb_exchange_token={short-lived-token}
... with this token but it says No user access token specified
Can someone help me step by step how to get the long lived token?
As you just want to pull, you really don't need a page access token. Until and unless you have a demographic or other restriction over your page. All the pages are Public and data over them can be easily accessed by using the App Access Token which is simply put
Your_App_ID|Your_App_Secret
first u need to get an API key from facebook, so here are the steps--->
http://www.shoutmeloud.com/how-to-acquire-your-facebook-api-key.html
& then u can access facebook API, these are docs provided by the facebook to use that API--->
https://developers.facebook.com/docs/guides/web/
This was my implementation (PHP):
$newposts = json_decode(file_get_contents("https://graph.facebook.com/YOURFBPAGE/feed&access_token=YOURAPPID|YOURAPPSECRET"));
Since I was only using this to make simple pull request of my feed posts this is the best way to do it. You don't have to deal with expiring access tokens. Just create your facebook App and get the ID and secret.

Facebook graph api user access token

I've been working on a website which use public facebook information such as posts.
There are few important things i'd like to emphasize :
User access token is definitely different from app access token
I'm not building a facebook app , but a site which uses facebook public information.
The problem comes up when I use a certain user access token , and about half an hour later I can not use this access token anymore becuase it has expired.
I'd like to know how am i able to get a permanent or at least a long term user access token ?
Thanks in advance
I don't think you can set when it expires. However the auth token should be extended whenever you need it and it has expired. The reason it's short is probably for security.
(I've only worked with the iOS SDK but I assume it follows the same principle)

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.

What is the deal with offline_access? Is it still in use?

I can request an access_token upon supplying an offline_access scope parameter to oauth. I can execute OpenGraph commands that require an access_token just fine when logged out of Facebook, and when I log back in, I don't need to create a new one.
According to this blog post, offline_access is (getting?) deprecated.
Confusions:
Why doesn't the authentication dialog display that I am requesting offline access when authenticating a user?
Is it currently safe to rely on persistent access_tokens?
Clarification greatly appreciated!
The Facebook API generally shouldn't be accessed when the user isn't online. You can update the access token anyways, and that should be good enough.
From: http://developers.facebook.com/blog/
There are no changes required for most apps, but developers utilizing
the 'offline_access' permission will have until May 1, 2012 to update
their apps.
You have some time....