Facebook authentication and subsequent ajax calls : efficiency and caching
My web application features a FB login button which is wired to some client side javascript to modify an html "online" element. The PHP side features the standard constructor
function facebook()
{
return new Facebook(
array(
'appId' => getSetting("fb:app_id"),
'secret' => getSetting("fb:secret")
));;
}
Now my understanding is that this should and could take care of all access token caching etc. So why do subsequent ajax calls back to my开发者_开发技巧 server app (which then does FB authentication again) take so long? I do need to recreate the Facebook object at every page access dont I? And it should take care of efficiency via its own session management?
Or am I approaching it incorrectly? Should I do this once to determine things like user FB ID (which I then use for app specific authentication) and then inform the server of log in/out with ajax call backs so my server is aware of the FB status? Hopefully this makes some kind of sense!
Need to cache on the php side and not reauthenticate on each call back.
精彩评论