As noted in the Facebook API documentation as of 25 March 2017, the API version 2.2 is no longer available. This has broken core functionality due to the access token value being returned as a JSON object now.

The changelog notes:
[Oauth Access Token] Format - The response format of https://www.facebook.com/v2.3/oauth/access_token returned when you exchange a code for an access_token now return valid JSON instead of being URL encoded. The new format of this response is {"access_token": {TOKEN}, "token_type":{TYPE}, "expires_in":{TIME}}. We made this update to be compliant with section 5.1 of RFC 6749.

I'm supplying a patch which resolves this issue and uses json_decode on the result instead of expecting a URL encoded string.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zeyus created an issue. See original summary.

zeyus’s picture

zeyus’s picture

Status: Active » Needs review
stevendeleus’s picture

this doesn't seem to work for me

zeyus’s picture

vectorbross: Have you cleared the cache? I ask because the first response is cached. Until that expires, facebook pull will not attempt to authenticate or retrieve a post.

stevendeleus’s picture

Yes, I have. This is the error I'm getting:
Warning: file_get_contents(https://graph.facebook.com/KSDiest/feed?{"access_token":"...|...","token_type":"bearer"}&limit=5&locale=nl): failed to open stream: HTTP request failed! HTTP/1.1 400 Bad Request in _facebook_pull_feed() (line 279 of sites/all/modules/facebook_pull/facebook_pull.module).

sundays’s picture

Patch #2 worked for me, thanks!
I was having the same error as #6.
Make sure you clear the caches so facebook pull retrives fresh data from FB instead of drupal's cache.

mvnovick’s picture

Vectorbross, it looks like you haven't applied the patch. The error you see is exactly what I saw before I applied the patch.

The Facebookpull module works correctly for me now, after I applied the patch from #2.

stevendeleus’s picture

Sorry, I applied the patch to the wrong site. It is working now!

darvanen’s picture

Patch looks good, and works on a fairly complex site. +1

Wye Yu’s picture

Status: Needs review » Reviewed & tested by the community

Thanks for the patch @zeyus !

I have tested this on both dev and prod environment and it works perfectly. No issue found in the code upon review either.

agileadam’s picture

Confirmed. Fixed the issue for me. Thanks!

zeyus’s picture

@vectorboss : Please, please edit your comment, and go to Facebook and revoke the access token. You've publicly posted a token which gives API access to your account. This is a listing but if the token isn't limited in scope then someone can maliciously post on your behalf:
https://xxx/

stevendeleus’s picture

@zeyus I reset the access token to something else and edited my comment. Thanks for the heads up.

stefan.r’s picture

RTBC++

  • daveferrara1 committed 3cc6e9c on 7.x-3.x
    Issue #2864546 by zeyus: Facebook graph API v2.2 unavailable.
    
daveferrara1’s picture

Assigned: zeyus » Unassigned
Status: Reviewed & tested by the community » Fixed

7.x-3.2 Includes this fix.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.