问题
This code:
$fql2 = "SELECT uid, name FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = xxxxxxxxx)";
$params = array(
'method' => 'fql.query',
'access_token' => $user->accessToken,
'query' => $fql2,
'callback' => ''
);
$result = $facebook->api($params);
var_dump($result);
Gives me error: Uncaught Exception: 101: Invalid API key
My appId and secret are correct. I have checked it by executing $facebook->api('/me')
which works perfectly alright. My access token is alright too with all required permissions. There's some problem with the way i'm trying to call the api to execute fql query.
回答1:
I think you have to write
$user->getAccessToken();
来源:https://stackoverflow.com/questions/14205935/invalid-api-key-exception-facebook-php-sdk-fql