Exchanging codes for access tokens from facebook.com/connect/uiserver.php is the same as from facebook.com/dialog/oauth ?
I mean, this works just fine on my site: https://developers.facebook.com/docs/authentication/server-side/
But when I try to process code from auth dialog generated by Facebook itself (links from actions) it fails every time with a "100" error code.
Using "client_cred" as "type" I was able to get the app token, which is useless.
The "redirect_uri" are exactly the same.
Best part is that a simple refresh works! Maybe some sync issue?!
Very sad, but I found a way... kind of:
After trying to get the token (and failing), I hit Facebook oauth AGAIN and this time people wont see the dialog (as it is already authorized) and I get a good code to exchange for a good token and thus, it will not loop, as now I have a $token.
if(empty($token)) {
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url);
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}