Facebook API OAuthException: “An unexpected error has occurred. Please retry your request later” when trying to retrieve a Page-specific access token

Just suddenly started working this morning—no idea why.


I think I can shed a little more light on this.

I get this return often when making a request for the Page specific access tokens; failures on this call seem to be proportional to the number of Page's that are administered by the account for which the access token is for, so if you admin 100 pages, you will fail more often than if you have 1 pages, if you have a 5000 pages failures will happen more often than they don't.

This indicates that the failure is related to the response size, as the JSON returned can be very lengthy for large sets of Page's.

The fix for this is simple. Instead of requesting all of the Page's using

http://graph.facebook.com/me/accounts?access_token={admin access token}

use

http://graph.facebook.com/{page id}?fields=access_token&access_token={admin access token}

This will return the access token for just that page. Because the response is small you should experience Facebook server-side errors much less frequently. Since I switched I don't think I've ever experienced a failure and I make the call very often.