Getting "Error validating access token" from Facebook for some users

herbrandson picture herbrandson · May 12, 2011 · Viewed 51.1k times · Source

I'm getting the following error from Facebook when trying to post to a users stream.

Error validating access token: The session has been invalidated because the user has changed the password or because auth.expireSession was called.

The workflow is as follows:

  1. Authorize with Facebook requesting scope=offline_access,publish_stream permissions (if the current user has not already authorized)

  2. Do some work on the server (takes 5-10 minutes)

  3. Attempt to publish to the user's Facebook stream

This code works for many users, but for some users, I get the Error validating access token error. It started frequently happening a few weeks ago, then seemed to stop, and now happen a lot again. I'm certainly not calling auth.expireSession on my end, and it seems unlikely that multiple users would be changing their password in the 5-10 minute window from authorizing to publishing. Does anyone know what might be causing this?

Answer

Douglas Purdy picture Douglas Purdy · Jul 30, 2011

Anytime you get this error, you should run the user back through the auth flow. There are many reasons that either the user or we will invalidate a session. We have a how-to on this at https://developers.facebook.com/blog/post/500