doudu5029 2012-03-21 17:08
浏览 65

Facebook访问令牌混淆与Javascript SDK

I have a facebook connect button set up with Javascript using FB.login on my website so the users profile image and name shows etc.. without refreshing the page. Here is a small piece of the code:

function updateButton(response) {
                button       =   document.getElementById('fb-auth');
                userInfo     =   document.getElementById('user-info');

                if (response.authResponse) { 
                    //user is already logged in and connected
                    FB.api('/me', function(info) {
                        login(response, info);
                    });

                    button.onclick = function() {
                        FB.logout(function(response) {
                            logout(response);
                        });
                    };

But I also have a system so when the user clicks (or has previously) liked my facebook page, the user of my website gets points added to their account (on my website) - error checks in place etc..

My problem is, in order for the like system to work they need permissions to be accpeted. Although they do accept these when they first login, they also seem to need to keep logging in via the Javascript SDK button for the like to work.

If they have not logged in via the JS SDK and go to click on the embedded like button on my site, it asks them to login and when they do any my code runs for the like system, an error shows which is an oAuth error (meaning they have not got a valid access token/ have not logged in).

My question is, I am not sure if the user should keep logging in when they re-visit my site, and for that matter, why does the user need to have logged in specifically through the Javascript SDK FB.login function?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 python忆阻器数字识别
    • ¥15 无法输出helloworld
    • ¥15 高通uboot 打印ubi init err 22
    • ¥20 PDF元数据中的XMP媒体管理属性
    • ¥15 R语言中lasso回归报错
    • ¥15 网站突然不能访问了,上午还好好的
    • ¥15 有没有dl可以帮弄”我去图书馆”秒选道具和积分
    • ¥15 semrush,SEO,内嵌网站,api
    • ¥15 Stata:为什么reghdfe后的因变量没有被发现识别啊
    • ¥15 振荡电路,ADS仿真