I'm trying to implement Google Friend Connect as a sign in solution. I've implemented Facebook Connect using the PHP client, and I'd like to use the same approach for Google Friend Connect (OpenSocial), using the OpenSocial PHP client library (http://code.google.com/p/opensocial-php-client/). Once the user has connected, I'd like to get their OpenSocial id and log it into the database.
Here's the code so far:
$gfc_provider = new osapiFriendConnectProvider();
$gfc_auth = new osapiOAuth2Legged(GFCAPIKEY, GFCSECRET);
$gfc_osapi = new osapi($gfc_provider, $gfc_auth);
$batch = $gfc_osapi->newBatch();
$batch->add($gfc_osapi->people->get(array('userId' => '@me')));
$result = $batch->execute();
print_r($result);
Here's the response:
Array (
[0] => osapiError Object (
[errorCode:private] => 400
[errorMessage:private] =>
Cannot ask for me when anonymous
Error 400
[response] =>
)
)
I am not sure what I'm doing wrong. Any suggestions?