The latest version of the Facebook PHP SDK makes it easy to get a long-lived access_token
, giving you access to the user’s profile for up to 60 days, opposed to 1-2 hours with the regular access_token
. The long-lived access_token
can be used to perform tasks on the user’s behalf for long periods of time, for example, accessing check-in data for up to 60 days.
The setExtendedAccessToken()
function exchanges the user’s short-lived access token for a long-lived one in just a few short lines of code:
The long-lived access_token means the user doesn’t need to login to your application for an extended period of time. In addition, using the long-lived access token with the manage_pages
permission gives you access to page tokens that do not expire.
Note:
Just like short-lived access token, the long-lived token expires if the user changes their password, deauthorizes an app, or logs out. In these cases, the app should handle errors gracefully.
thats not what its gonna do. if you will see the facebook api the $facebook->setExtendedAccessToken(); will get it from session. you stupid you just copy paste code here without trying
Did you even look at the code? This is what it looks like. Please tell me where it’s getting it from the session. Check your facts before you make a fool of yourself.
Hello Niraj,
I’m trying to use this in Google Spreadsheets, and using email addresses to get UID. How would I set up sheet to take an email address and pull it’s UID out?
Why are you using Google Spreadsheets for this? You should be using a proper database like MySQL or even Parse to store and retrieve information.
Because I am learning how to interact with Facebook API at the moment still learning, don’t know where to start outside of what I know.
Hi, Niraj,
I have facebook page URL in my mysql database.I want to fetch each page reviews and store it in database using cron job.Please help.Post code related to this.I am still stuck in getting page access token.
Sorry, I don’t post code for specific problems unless you’re tried something yourself. Please post your code and question on StackOverflow.