I had the same problem and solved it.
First: Do not use & type = client_cred .
Second: use the same URL everywhere!
My example:
My first link:
<a href="https://www.facebook.com/dialog/oauth?client_id=_MY_APP_ID_&state=_RANDOM_NUMBER_&redirect_uri=http://mysite.ru/ru/site_users.html?op=fbreg">FB login</a>
When I received the code:
$nexturl = "https://graph.facebook.com/oauth/access_token?client_id=".$AppId."&redirect_uri=http://mysite.ru/ru/site_users.html?op=fbreg&client_secret=".$AppSec."&code=".$fbCode; $response = @file_get_contents($nexturl); $params = null; parse_str($response, $params); $graph_url = "https://graph.facebook.com/me?access_token=".$params['access_token']; $arrResponse = json_decode(@file_get_contents($graph_url));
In $ arrResponse, I got all the information about the current user.
The URL value must be the same everywhere . In code and in https://developers.facebook.com/apps/ .
In my case it is: http://mysite.ru/ru/site_users.html?op=fbreg
In my example, the following are incorrect.
http://mysite.ru/http://mysite/http://mysite/ru/site_users.html
That's all. Very stupid problem. I solved this in three days :(
source share