Ben Facebook PHP SDK (2.1.2) kullanıyorum. Ben yapmak istediğim hemen hemen her Facebook uygulaması req_perms budur. Bunu yüklediğinizde açılır kutusunun aptal "izinleri için" talebi.
Ben kullanıcı itmek zorunda olan bir düğmeye istemiyorum. Ben bir pop-up görünmesini istemiyorum. Ben FBML, since they're doing away with it kullanmak istemiyorum.
Bu benim uygulama tuval iframe içinde göstermek nerede gösterir standart Facebook izinleri iletişim olduğunu.
Denedim:
<?php if(!$me): ?>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; <?php echo $loginUrl; ?>">
</head>
<?php die(); ?>
<?php endif; ?>
Bu, nedense, ben istediğim doğru URL'ye bağlanan bir Facebook logosu gösterdi (not what I want!)
<?php if($me): ?>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Whenever the user logs in, we refresh the page
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<fb:redirect url="<?php echo $loginUrl; ?>" />
<?php die("</html>"); ?>
Bu bir boş bir sayfa gösterdi.
<?php if($me): ?>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
// Whenever the user logs in, we refresh the page.
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<script>
FB.login(function(response) {
if (response.session) {
if (response.perms.indexOf('publish_stream') != -1) {
//User has logged in and given us publish_stream permissions
);
else {
//User has logged in but not given us publish_stream
}
}
else {
//User is not logged in
}, {perms:'offline_access,publish_stream'});
</script>
Bu da boş bir sayfa gösterir.
Ne istiyorum sevilmeyen değil, Facebook belgeler şimdiye genelinde geldim kötü belgelerdir. Hiçbir şey çalışır. Bu idiotically şey basit anlamaya iki gün almamalıdır.
İşte ben ile sona erdi çözüm:
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : '<?php echo $appid; ?>',
session : <?php echo isset($session) ? "'".json_encode($session)."'" : 'null'; ?>, // don't refetch the session when PHP already has it
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.getLoginStatus(function(response) {
if (response.session) {
// Logged in and connected user, someone you know.
} else {
// No user session available, redirect them to login.
window.top.location = "<?php echo $loginUrl; ?>";
}
});
// Whenever the user logs in, we refresh the page.
FB.Event.subscribe('auth.login', function() {
window.location.reload();
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>