1

I already integrate django-facebookconnect on my project, but when user login email field stay empty, i mean this app does not save user email ??

It seems like it does:

user = User(username=request.facebook.uid, 
                    password=sha.new(str(random.random())).hexdigest()[:8],
                    email=profile.email)

But when i check it does not saves email, is this an error or a facebook restriction?

marman
  • 417
  • 1
  • 4
  • 16

1 Answers1

0

You need to get the extended permission from facebook.

<?php 
$app_id = "YOUR_APP_ID";
    $app_sec = "APP_SEC";
$canvas_page = "APP_CANVAS_PAGE_URL";
$scope = "&scope=user_photos,email,publish_stream";           $auth_url"http://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" .       urlencode($canvas_page).$scope; 
$signed_request = $_REQUEST["signed_request"];   
list($encoded_sig, $payload) = explode(".", $signed_request, 2); 
$data = json_decode(base64_decode(strtr($payload, "-_", "+/")), true); 
 if (empty($data["user_id"])) {
 echo(""); } 
 $access_token = $data["oauth_token"]; 
$user_id = $data["user_id"]; 
    $user = json_decode(file_get_contents( "https://graph.facebook.com/me?    access_token=" .         $access_token)); 
function get_facebook_cookie($app_id, $application_secret) { 
$args = array();
parse_str(trim($COOKIE["fbs" . $app_id], "\""), $args); 
    ksort($args);
$payload = ""; 
foreach ($args as $key => $value) { 
if ($key != "sig") { 
$payload .= $key . "=" . $value; 
} 
} 
if (md5($payload . $application_secret) != $args["sig"]) {
return null; 
} 
return $args; 
} 
$cookie = get_facebook_cookie($app_id, $app_sec); 
?>
Damodaran
  • 10,882
  • 10
  • 60
  • 81
  • Hi Damodaran! thanks for that tip, i found a way to request user permission using JS SDK in this page http://phdrocks.wordpress.com/2010/03/08/getting-extended-permissions-in-facebook/ – marman Jan 19 '11 at 18:15