Sign in to application using facebook account.

You must Login before you can answer or comment on any questions.

Hi All,

I working on an application where I need to sign in to the application using facebook. Let say there is a sign in page which have a button said "Connect withfacebook". When I will click on that button it will open the facebook application page on browser where I will have a button "Okay". On click of okay button the we will be back to our application and will be redirect to home page of the application with sign in successfully.

Please suggest...

1 Answer

Accepted Answer

here is an example which have been taken from the Facebook SDK Api page http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Facebook

// Don't forget to set your appid and requested permissions, else the login button
// won't be effective.
Ti.Facebook.appid = '[your appid]';
Ti.Facebook.permissions = ['publish_stream'];
Ti.Facebook.addEventListener('login', function(e) {
    if (e.success) {
        alert('Logged in');
    }
});
Ti.Facebook.addEventListener('logout', function(e) {
    alert('Logged out');
});
 
// Add the button.  Note that it doesn't need a click event listener.
win2.add(Ti.Facebook.createLoginButton({
    top : 50,
    style : Ti.Facebook.BUTTON_STYLE_WIDE
}));

Your Answer

Think you can help? Login to answer this question!