Facebook upgrade php-sdk-v4 to graph-sdk v5, login in popup

262 views Asked by At

I am trying to upgrade Facebook php-sdk-v4 to graph-sdk, and after following all the steps from documentations, I reached a problem. The idea, which is what we were being doing until now, is to log him to our site with his FB account. But now, instead session, v5 wants accessToken, that when trying to get it ($helper->getAccessToken()) finishes into a return $_GET['code']. Happens that our procedure is to open the FB login page in a popup (colorbox), and first it complains that it can't take the get 'code', but if i open it in a new tab, the url has the 'code' parameter as $_GET method, put this exception appears: Facebook\Exceptions\FacebookSDKException: Cross-site request forgery validation failed. Required param "state" missing from persistent data.

This is solved via popup because it makes the makeUrl() (which inserts 'state' in persistent), but the url doesn't have 'code' as url param. So one way solves a problem that exists in other way and viceversa.

Halp.

Edit: I used redis to get and set those params with in the facebookPersistence class and it solved it

0

There are 0 answers