- Home /
Unity game on facebook question
Hello!
I have created a canvas page on facebook with my Unity web content. It looks good: http://apps.facebook.com/supergun/ But is it normal that no Request for Permission appear when my friend open the app from this page: http://www.facebook.com/apps/application.php?id=216020301767130 ?
Answer by aronsommer · Oct 21, 2011 at 11:14 PM
Hello wolfgang. If you want that your app makes bookmarks in the user favorites and generate stories like "wolfgang is playing app" you have to ask for the basic permissions. change the .html suffix to .php and put following code at the top of the file:
you will find more information on this link: https://developers.facebook.com/docs/authentication/
<?php
$app_id = "APP ID";
$app_secret = "APP SECRET";
$my_url = "APP URL";
session_start();
$code = $_REQUEST["code"];
if(empty($code)) {
$_SESSION['state'] = md5(uniqid(rand(), TRUE)); //CSRF protection
$dialog_url = "https://www.facebook.com/dialog/oauth?client_id="
. $app_id . "&redirect_uri=" . urlencode($my_url) . "&state="
. $_SESSION['state'];
echo("<script> top.location.href='" . $dialog_url . "'</script>");
}
if($_REQUEST['state'] == $_SESSION['state']) {
$token_url = "https://graph.facebook.com/oauth/access_token?"
. "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url)
. "&client_secret=" . $app_secret . "&code=" . $code;
$response = file_get_contents($token_url);
$params = null;
parse_str($response, $params);
$graph_url = "https://graph.facebook.com/me?access_token="
. $params['access_token'];
$user = json_decode(file_get_contents($graph_url));
}
?>
Thanks for the response, but i think that for now i want something very basic, i already enter to your app supergun (cool!) and the first thing that facebook does is asking if i accept the basic permissions and when i accept then i can play your game, THAT is what i want my app do!, currently my app doesnt ask for permissions anyone (even a non facebook logged user) can enter to my app. With the code from above i really be able to do that? where do i put the extended permissions array?
I think is here o im wrong ?
if($_REQUEST['state'] == $_SESSION['state']) { $token_url = "https://graph.facebook.com/oauth/access_token?" . "client_id=" . $app_id . "&redirect_uri=" . urlencode($my_url) . "&client_secret=" . $app_secret . "&code=" . $code;
Thanks again, and sorry for my english...
Answer by Joshua · Jul 10, 2011 at 05:09 PM
They just open the app, I think permission is for letting the app - for instance - write to your wall, etc.
Answer by wolfgang_almeder · Oct 21, 2011 at 07:34 PM
Hi arar, sorry for asking here, im new in facebook app development, how you managed to ask for permissions when a person enter your app? where do you put the code scope=> ? is in the html that comes when you compile your game for web platform ??
thanks in advance.
Answer by Dover8 · Nov 07, 2011 at 04:50 PM
Can I ask how you got your unity game onto facebook? I have my facebook app, and my unity game, but not sure yet on how to put the two together.
I think you need to go to this page and study a little. They have a lot of information about how you intergrate you own website/webpage with Facebook: http://developers.facebook.com/
Answer by Dover8 · Nov 07, 2011 at 04:50 PM
Can I ask how you got your Unity game onto facebook? I have my unity game and my facebook app, just not sure on how to put the two together. Any help would be appreciated
I think you need to go to this page and study a little. They have a lot of information about how you intergrate you own website/webpage with Facebook: http://developers.facebook.com/