通过Facebook API无法登录 [英] Can't login via facebook API

查看:208
本文介绍了通过Facebook API无法登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的JavaScript SDK允许用户登录到Facebook上,找回自己的朋友配置文件的图片,然后最后张贴在墙上的用户登录信息。问题是,我不断收到一个错误,错误而来自无极的铅笔,加载页面时,用户批准的应用程序。

I'm using the Javascript SDK to allow the user to login to facebook, retrieve their friends profile pictures, and then finally post a message on the logged in users wall. Problem is I keep getting an error, "Error while loading page from Pencils of Promise," when the user has to authorize the application.

<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({appId: '154058871279888', status: true, cookie: true,
             xfbml: true});

console.log(FB.getLoginStatus());

$('div.voice-btn:eq(0)').click(function() {
    FB.login(function(response) {
        if(response.session) {                
            FB.api('/me', function(data) {
                console.log(data);
            });

            donateVoiceSlider();
          }
    });
});

$('#voice-step-2-btn').click(function() {
    var body = 'Test Facebook post';
    FB.api('/me/feed', 'post', { body: body }, function(response) {
         if (!response || response.error) {
            alert('Error occured');
        } else {
            alert('Post ID: ' + response);
        }
    });
});

// Donate Voice Content Slider
function donateVoiceSlider() {
    var $ul = $('#donatevoice');
    var cur_left = parseInt($ul.css('left'));
    var li_width = 980;

    $ul.animate( {'left': cur_left-li_width+'px'} );
}
</script>

请帮帮忙!

推荐答案

我的朋友谁曾创建的应用程序没有设置网站的网址。这样做之后,一切都运行平稳。

My friend who had created the application did NOT set the site URL. After doing that, everything ran smoothly.

这篇关于通过Facebook API无法登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆