I am using the facegap plugin for facebook and facebook javascript api. here is my code
FB.init({ appId: "xxxxxxxxxxxxxxx", status: true, oauth :true, nativeInterface: CDV.FB, //channelURL : 'www', // Channel File cookie: true, //useCachedDialogs: false, xfbml: true }); FB.login(function(response) { if (response.authResponse) { alert(response.authResponse.userID); // literally shows three dots FB.api('/me', function(me){ if (me.id) { alert(me.id); // this works } }); } }, { scope: "email" });
I can get accessToken from authResponse .... its long string. but the userID field is literally "...". I can get the user ID by making an extra trip to the server with another call to the graph API to get /me , but that seems wasteful.
source share