I'm running a node.js server app, using everyauth for my authentication scheme and attempting to reach out to the Facebook API from my server. The way I currently handle this once the user is logged in (via everyauth using the Facebook module) is:
var oauth = everyauth.facebook.oauth;
oauth.get('https://api.facebook.com/method/fql.multiquery?format=json&queries=' + multiquery, req.session.auth.facebook.accessToken, function (err, data) { // do stuff here });
This works initially but after a few minutes, typically around 10m of inactivity, I start getting an expired token response from the Facebook API:
Error validating access token: Session has expired at unix time...
After reading some Facebook docs it seems as if most access tokens should last for a default 2 hours so I'm wondering if I'm not forming the API call in the right way. Any suggestions/ideas welcome, thanks!
EDIT:
Just a bit more info, the expire unix time returned from the error call is indeed less than the current time, just not sure why it would be so short. In the meantime I'll do a bit more debugging...