Having completed and tested one Facebook app for some days on a development server (not Joyent’s), when I put it on the Joyent Smart Machine to make it live, it did not work there. Facebook’s graph API $me object and all other api call on Joyent server returned null.
require_once 'facebook.php';
// Create our Application instance.
$facebook = new Facebook(array(
'appId' => 'APPID',
'secret' => 'SECRET',
'cookie' => true,
));
While the $session object was available but when api was called for “/me” $me, it was always null.
$me = $facebook->api('/me');
print_r($me); // null
In the end, solution was very simple.. You just need to submit your app to the directory and get it approved before its $me object is available to you in the Joyent environment.
The same app worked just fine on many other servers without submitting to the directory, now why would Joyent not make it available in the first place is beyond comprehension.
There was no solution either on Joyent community although some had already posted for the same issue.
It wasted quite a lot of time, but hope that this post helps those who are stuck like me with this not so smart machine and the irony here is that it was me who recommended the Joyent hosting to the client having seen their Facebook partnership and recommendation!
Sighs!
I spent hours trying to figure this out.. so what do you do to solve this?
i.e. how do you ” submit your app to the directory and get it approved”
Hi Justin,
You can resolve this issue by publishing your application.
From this Facebook Developers page, you will see list of your apps in the right panel. Select your application from there and you will see this:
Click on the submit it link and you are done. Hopefully your app will start working on Joyent [not so] Smart machine.
Cheers & Happy new year!