Try this code, its alloys and hope that it helps you, otherwise I will check and let you know
index.xml
<Alloy> <Window class="container"> <LoginButton id="fbButton" ns="Alloy.Globals.Facebook"/> </Window> </Alloy>
index.js
var fb = Alloy.Globals.Facebook; fb.appid = xxxxxxxxx; fb.permissions = ['publish_stream', 'create_event', 'email']; $.fbButton.style = fb.BUTTON_STYLE_WIDE; fb.addEventListener('login', function(e){ if(e.success){ fb.requestWithGraphPath('me', {}, 'GET', function(e) { if (e.success) { //alert(e.result); var response = JSON.parse(e.result); var email = response.email; var name = response.name; var gender = response.gender; alert(name+' '+email+' '+gender); alert('Logged in Successfully'); } else if (e.error) { alert(e.error); } else { alert('Unknown response'); } }); } });
alloy.js
Alloy.Globals.Facebook = require('facebook');
source share