Skip to content

Instantly share code, notes, and snippets.

@KarthiPnsmy
Created September 23, 2012 08:04
Show Gist options
  • Save KarthiPnsmy/3769299 to your computer and use it in GitHub Desktop.
Save KarthiPnsmy/3769299 to your computer and use it in GitHub Desktop.
ACS Social Integrations Part 2
Titanium.Facebook.addEventListener('login', function(e) {
if (e.success) {
Cloud.SocialIntegrations.externalAccountLogin({
type : 'facebook',
token : Ti.Facebook.accessToken
}, function(e) {
if (e.success) {
var user = e.users[0];
Ti.API.info('User = ' + JSON.stringify(user));
Ti.App.Properties.setString('currentUserId', user.id);
alert('Success: ' + 'id: ' + user.id + '\\n' + 'first name: ' + user.first_name + '\\n' + 'last name: ' + user.last_name);
} else {
alert('Error: ' + ((e.error && e.message) || JSON.stringify(e)));
}
});
} else if (e.error) {
alert("Error = " + e.error);
} else if (e.cancelled) {
alert("canceld");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment