Facebook OAuthException: The access token could not be decrypted
facebook, facebook-graph-api, php
Solution
If you get the following error message when making HTTP requests to the Facebook API:
{
"error": {
"message": "The access token could not be decrypted",
"type": "OAuthException",
"code": 190
}
}
it means that the access token you are sending to Facebook when you make the HTTP request is NOT valid.
If you look at the HTTP response headers you will see a field like this:
WWW-Authenticate:OAuth "Facebook Platform" "invalid_token" "The access token could not be decrypted"
I was receiving the error above because I was sending an access token that was 1 character shorter than what was the valid one. After comparing the access token persisted with the one I was sending I discovered this mistake.
You can check the validity of the OAuth 2.0 access token (bearer token) used on Facebook with the Access Token Debugger.
Problem
I have a running application that does scheduled wall posts to one of their friends on behalf of the user. The application was running fine for quite some time but recently quiet a few of the users have reported the messages not being posted. The logs shows ``` OAuthException: The access token could not be decrypted. ``` Even if the user revisits the application and resets their Access token the exception persists. What may be the root of the error and ways to work around it?