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.
Comment | File | Size | Author |
---|---|---|---|
#2 | facebook_pull-2864546-graph_api_token_fix-1-D7.patch | 968 bytes | zeyus |
Comments
Comment #2
zeyus CreditAttribution: zeyus commentedComment #3
zeyus CreditAttribution: zeyus commentedComment #4
stevendeleus CreditAttribution: stevendeleus commentedthis doesn't seem to work for me
Comment #5
zeyus CreditAttribution: zeyus commentedvectorbross: 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.
Comment #6
stevendeleus CreditAttribution: stevendeleus commentedYes, 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).
Comment #7
sundays CreditAttribution: sundays commentedPatch #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.
Comment #8
mvnovick CreditAttribution: mvnovick commentedVectorbross, 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.
Comment #9
stevendeleus CreditAttribution: stevendeleus commentedSorry, I applied the patch to the wrong site. It is working now!
Comment #10
darvanenPatch looks good, and works on a fairly complex site. +1
Comment #11
Wye Yu CreditAttribution: Wye Yu commentedThanks 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.
Comment #12
agileadamConfirmed. Fixed the issue for me. Thanks!
Comment #13
zeyus CreditAttribution: zeyus commented@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/
Comment #14
stevendeleus CreditAttribution: stevendeleus commented@zeyus I reset the access token to something else and edited my comment. Thanks for the heads up.
Comment #15
stefan.r CreditAttribution: stefan.r commentedRTBC++
Comment #17
daveferrara1 CreditAttribution: daveferrara1 commented7.x-3.2 Includes this fix.