Facebook single sign-on titanium android

I work with titanium platform, when I implement SSO in iOS it works great, I do it one or more times, it works smoothly and perfect. but when i come to android it works for the first time but not after that. For example, I installed a test app on Android and clicked facebook login, it works the first time, but when I log out and try to login with facebook, then it just displays a redirect to facebook app, but the app fails. i tried many times and tried many times but didn't work.

I have placed a facebook event listener in app.js and in someindow.js I have a facebook login button. i am doing some work after facebook login means redirect to another window.

early.

+3


source to share


2 answers


Actually the problem persists because of the cache. we need to clear cache when you log out using below code it works fine



 Titanium.Facebook.appid = "XXXXXXXXXXXXXXXXXX";
 Titanium.Facebook.permissions = ['publish_stream', 'read_stream'];


   var fbButton =  Ti.UI.createButton({
    top: 68,
    width:290,
    height:52,
    backgroundImage:"images/login/facebook.png"
});


 fbButton.addEventListener('click', function() {
if(Titanium.Facebook.loggedIn){
    Titanium.Facebook.logout()
    return
}
 Titanium.Facebook.authorize();

  });




Ti.Facebook.addEventListener('login', function(e) {
if (e.success) {
    win.close()
} else if (e.error) {
    alert(e.error);
} else if (e.cancelled) {
    alert("Canceled");
}
 });

  Titanium.Facebook.addEventListener('logout', function(e) {
    var url = 'https://login.facebook.com';
    var client = Titanium.Network.createHTTPClient();
    client.clearCookies(url);
});

      

+1


source


Use this flag Ti.Facebook.forceDialogAuth = false;



0


source







All Articles