Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Facebook Multiple Accounts ...

Using the Ti.Facebook.LoginButton a user can login and logout of a single Facebook account all day long … Login/Logout … Login/Logout …

How can I get the user to login to a different Facebook account?

Clicking the Login button just logs the user into the same Facebook account!

Are there some settings somewhere that can be reset/deleted to trigger the login screen?

— asked December 2nd 2010 by JD Hofer
  • facebook
0 Comments

5 Answers

  • no answer ??

    — answered May 31st 2012 by Louis Wong
    permalink
    5 Comments
    • +1 waiting for an answer to this. After logging in once, then calling Ti.Facebook.logout(), then calling Ti.Facebook.authorize() again just results in the Facebook Login dialog to open and close, using the user that logged in for the first time.

      — commented June 1st 2012 by Chris Leuenberger
    • +1 I'm also having this problem. Calling Ti.Facebook.logout() used to work as recent as last month (May 2012). It appears something has changed on Facebook's end and fb module is now broken.

      — commented June 6th 2012 by Dana Brooks
    • It was reported as a bug here – https://developers.facebook.com/bugs/206960412749841

      — commented June 6th 2012 by Dana Brooks
    • nothing yet?

      — commented January 3rd 2013 by Gustavo Clemente
    • I just noticed the same thing. Any resolution to this?

      — commented January 31st 2013 by matt s
  • put these 2 lines in your logout listener:

    var client = Ti.Network.createHTTPClient();
    client.clearCookies('https://login.facebook.com');
    

    so something like this:

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

    works for me. i get the a blank login dialog so i can enter new login creds.

    — answered March 15th 2013 by Scott L
    permalink
    0 Comments
  • … the facebook login and logout is a pain.

    I handle like this ( is not the better way, but It works ).

    global scope

        function actualizaFacebookStatus() {           
            }
    
            Titanium.Facebook.addEventListener('login', actualizaFacebookStatus);
            Titanium.Facebook.addEventListener('logout', actualizaFacebookStatus);
    

    login button

        Titanium.Facebook.addEventListener('login', function(g) {
                if (g.success) {
                    Titanium.App.Properties.setString("facebook",g.data.name);
                    e.rowData.title ='Vinculado a : '+ g.data.name;
                } else if (g.error) {
                    Titanium.UI.createAlertDialog({title:'Cazabaches DF', message: g.error, buttonNames:['Aceptar']}).show();                        
                } else if (g.cancelled) {
                }
        });
        Titanium.Facebook.authorize();
    

    logout button

    Titanium.Facebook.addEventListener('logout', function(g) {
        e.rowData.title = 'Agregar Facebook';
                Titanium.App.Properties.setString("facebook",'');
                setTimeout(hideIndicator,1500);
            });
    Titanium.Facebook.logout();
    

    I hope this code could you help.

    — answered March 27th 2013 by Jimmy García Contreras
    permalink
    1 Comment
    • I forgot this …

      Titanium.Facebook.appid = 'facebookid';
      Titanium.Facebook.permissions = ['publish_stream'];
      Titanium.Facebook.forceDialogAuth = true; // <--- Tried both
      

      — commented March 27th 2013 by Jimmy García Contreras
  • This code

    Ti.Facebook.addEventListener(&#39;logout&#39;, function(e) { var client = Ti.Network.createHTTPClient(); client.clearCookies(&#39;https:&#x2F;&#x2F;login.facebook.com&#39;); });

    does not clear cookies in iPhone app. How to login to app using new facebook account.?

    — answered September 26th 2013 by kabindra simkhada
    permalink
    0 Comments
  • Any update on this?

    — answered January 17th 2014 by Kristján Ingi Mikaelsson
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.