check facebook login with javascript -


i created facebook api script:

fb.api('/me/likes/112234512170409',function(response) {     if( response.data ) {         if( !isempty(response.data) )             alert('you fan!');         else             alert('not fan!');     } else {         alert('error!');                  alert("error: " + response.error.message);      } }); 

but error messages: error: active acces token must used to... here full code: http://pastebin.com/zfs6rgpj did wrong?

since script in body , not head, , execute code want instead of defining within function call later on, running api request (line #37 of code) on document load, before logged in (hence, no valid token). wrap api call function can call later, e.g.

var callmelater = function {    fb.api('/me/likes/112234512170409',function(response) {    ... }; 

and call callmelater(); after you've logged in.

if haven't checked out, perhaps steps 4 , 5 may helpful in http://developers.facebook.com/docs/howtos/login/getting-started/

let me know if problem works out or if need me clarify :)


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -