Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 228
herbrandson Avatar asked May 12 '11 03:05

herbrandson


People also ask

What does error validating access token mean on Facebook?

Message: Error validating access token: The user is enrolled in a blocking, logged-in checkpoint. This error message means that your Facebook user account has failed a security checkpoint and needs to log in at Facebook or the Facebook Business Manager to correct the issue.

How do I verify my Facebook access token?

You can simply request https://graph.facebook.com/me?access_token=xxxxxxxxxxxxxxxxx if you get an error, the token is invalid. If you get a JSON object with an id property then it is valid. Unfortunately this will only tell you if your token is valid, not if it came from your app.

What does it mean when you've been Checkpointed on Facebook?

The checkpoint, which takes people to the Facebook Security site, provides links to McAfee's Scan and Repair and Microsoft's Security Essentials at no charge. This latest security layer is an expansion of Facebook's own monitoring of the site for suspicious content.

What does invalid access token mean?

If you're trying to reset your password and you receive an error citing an “invalid token” or asking you for your token, it's likely that the link you clicked on to reset your password has expired. For security reasons, passwords are never sent out across the Internet.

What is error validating access token on Facebook Messenger?

The message “Error Validating Access Token” occurs while using Facebook/Messenger primarily by two groups of users; one are regular users accessing messenger and other are developers who are enabling Facebook login using the API. The error message is mostly related to the security process which Facebook implements when you access its platform.

What is an access token invalidation error?

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: Authorize with Facebook requesting scope=offline_access,publish_stream permissions (if the current user has not already authorized)

Why is the session in messenger against my account invalid?

The session in Messenger against your account is somehow invalid or has expired. The access token of Facebook which you are using with the API is expired. This happens in a lot of cases in an application’s development environment because the access token is only valid for a limited time before it has to be obtained again (for developers).

Do Facebook API access tokens expire?

If you are using the Facebook API and access tokens for the simplest of reasons (for example using Facebook for validating the signup process in your application), make sure that it is not expired. Usually, Facebook tokens expire within 2 hours after they are requested from the Facebook server.


1 Answers

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

like image 78
Douglas Purdy Avatar answered Oct 15 '22 14:10

Douglas Purdy