OAuthException Facebook - how to change the PHP SDK code to make sure this is taken care of

I get the following error when I try connecting via Facebook using the PHP SDK. How can I change the PHP SDK to account for this error - so that users never get this error:

OAuthException: Error validating access token: Session has expired at unix time 1344740400. The current unix time is 1344752273.

Also sometimes I lose access to the Facebook session, how can I fix that too? so that people can always connect via facebook?

I'm not using the offline_access but the new Facebook PHP SDK.

Answers


Look at this official blog post with the solution: How-To: Handle expired access tokens.


How can I change the PHP SDK to account for this error - so that users never get this error

You don’t change the SDKs code at all … what you do instead is, you go and do read up on what exceptions are and how to handle them in the PHP manual: http://www.php.net/manual/en/language.exceptions.php


Need Your Help

How to select different app.config for several build configurations

.net visual-studio configuration continuous-integration release-management

I have a dll-type project that contains MSTest integration tests. On my machine the tests pass, and I want the same to happen on a CI server (I use TeamCity). But the tests fail, because I need to ...

Boost.log: How to prevent the output will be duplicated to all added streams when it uses the add_file_log() function?

c++ c++11 boost boost-log boost-logging

I use the add_file_log() function to initialize a logging sink that stores log records into a text file. When I define several sinks, I have observed: