[英]Using php facebook sdk in joomla
Here is the sample what i have used for a social login in joomla. 这是我在joomla中用于社交登录的示例。 Iam having a problem to get extended permission so that i can recieve there email id.. 我有一个问题要获得扩展许可,以便我可以在那里收到电子邮件ID。
$facebookuser = @$_SESSION['facebookuser'];
$facebook = new Facebook(array(
'appId' => $params->get('fb_appid'),
'secret' => $params->get('fb_appsecret'),
'cookie' => true
));
$session =& JFactory::getSession();
$session->set( 'facebook', $facebook );
if(empty($facebookuser))
{
$session = $facebook->getUser();
if (!empty($session))
{
# Active session, let's try getting the user id (getUser()) and user info (api->('/me'))
try {
$uid = $facebook->getUser();
$user = $facebook->api('/me');
} catch (Exception $e) {
}
if (!empty($user))
{
$fbobject = new facebookloginHelper();
$storefb = $fbobject->fbstoreuser($user);
} else
{
# For testing purposes, if there was an error, let's kill the script
die("There was an error.");
}
}
else
{
# There's no active session, let's generate one
//$login_url = $facebook->getLoginUrl();
$login_url = $facebook->getLoginUrl(array(
'canvas' => 1,
'fbconnect' => 0,
'req_perms' => 'publish_stream,email',
'next' => 'http://www.oyeparty.com/bangalore',
'cancel_url' => 'http://www.oyeparty.com/bangalore'
));
//header("Location: " . $login_url);
}
}
Please help me. 请帮我。
Not sure if Joomla has a custom Facebook PHP SDK but the code presented above doesn't match the latest Official Facebook PHP SDK 不知道Joomla是否具有自定义的Facebook PHP SDK,但上面显示的代码与最新的Official Facebook PHP SDK不匹配
https://github.com/facebook/facebook-php-sdk https://github.com/facebook/facebook-php-sdk
With this being the way to get email
permissions 通过这种方式获得email
权限
$params = array(
'scope' => 'publish_stream,email',
'redirect_uri' => 'http://www.oyeparty.com/bangalore'
);
$loginUrl = $facebook->getLoginUrl($params);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.