My application is now finished, so to put it online I disabled 'sandbox mode' in application's page. But it's not working, if i'm logged as developer i can run the application, else i get a 404 error... Facebook told me it could take several minutes, but i disabled 'sandbox mode' at 11am !! Does Facebook need to validate my app?
问问题
119 次
1 回答
-1
I found the solution : we can't use header('location:xxx.php') for asking app authorization, (because $loginUrl is null) it must be like this :
try {
// On récupère l'UID de l'utilisateur Facebook courant
// On récupère les infos de base de l'utilisateur
$me = $fb->api('/me');
} catch (FacebookApiException $e) {
// S'il y'a un problème lors de la récup, perte de session entre temps, suppression des autorisations...
// On récupère l'URL sur laquelle on devra rediriger l'utilisateur pour le réidentifier sur l'application
$loginUrl = $fb->getLoginUrl(
array(
'canvas' => 1,
'fbconnect' => 0,
'redirect_uri' => 'http://www.facebook.com/pages/Point-dEncre-France-Page-officielle/178099798924693'
)
);
// On le redirige en JS (header PHP pas possible)
echo ("<script>top.location.href='".$loginUrl."'</script>");
BUT to redirect users into the canvas app i must use
header('location:xxx.php')
and not
<script>top.location.href="xxxx"</script>
otherwise FB redirect the user out of the canvas view.
And another tip : if you store the 'user id' into a db use a 'big int' column and not a 'int' column like i did!
Hope it will help people
于 2012-12-01T10:47:18.597 回答