Reputation: 3
I have received this error when logging into my app. It appears to me that only I have the problem. The others who are able to access the app have been able to access the app with the exception of me.
Fatal error: Uncaught OAuthException: Error validating access token: This may be because the user logged out or may be due to a system error. thrown in /home/dexp/public_html/mascaraza/fb-php-sdk/base_facebook.php on line 1254
This problem appeared out of the blue. Even when I reverted to my older backup of my app the problem still remains. I tried playing other games on facebook which works fine, and when I tried creating a new app and migrating my stuff over it still remains the same. I have also tried removing the app from my account and re-authenticating the app but with no avail.
What do I need to do to resolve this error?
Upvotes: 0
Views: 3563
Reputation: 45124
As written in How-To: Handle expired access tokens developers blog post
Access tokens for users can become invalid due to various reasons. In most cases, they can expire if it’s past the time specified by the
expires
field (by default access token have a 2 hour lifetime). What many developers do not realize is that an access token can also expire if a user changes her password, logs out or if she de-authorizes the app via the App Dashboard. It is very important that your apps handle such situations. If your access token expires, you need to reacquire a valid access token.
Before we could use offline_access
permission to get token that not expire (unless user is connected with application), this permission is now deprecated, see Deprecation of Offline Access Permission to see how you can get access_token
with longer expiration time.
Update:
As of Aug 2012 Facebook PHP-SDK have added simple way of extending access_token
(see How to extend access token validity since offline_access deprecation for more details)
Extracted from here.
Upvotes: 2