javascript - facebook log-in API calls timing -



javascript - facebook log-in API calls timing -

couldn't find similar plenty question i'll ask.

i'm trying utilize facebook log-in on page.

i did according the developer's guides. however, i'm not sure when can start calling fb.api calls. when user authenticated? how can know when operation done?

<script> window.fbasyncinit = function () { fb.init({ appid: 'someid', // app id channelurl: '//www.domain.com/channel.html', // channel file status: true, // check login status cookie: true, // enable cookies allow server access session xfbml: true // parse xfbml }); }; // load sdk asynchronously (function (d) { var js, id = 'facebook-jssdk'; if (d.getelementbyid(id)) { return; } js = d.createelement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_us/all.js"; d.getelementsbytagname('head')[0].appendchild(js); } (document)); </script>

now want phone call this

fb.api('/me', function (response) { facebookuser = response; alert('your name ' + response.name); });

but not sure when write time. undefined wherever set :/

you want run fb.getloginstatus() (https://developers.facebook.com/docs/reference/javascript/fb.getloginstatus/) before send user log in using fb.login() or if user logged in, phone call fb.api() method.

javascript facebook facebook-login

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -