Titanium Community Questions & Answer Archive

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

Ti.Facebook.session not populated

I'm using the latest 1.5.0 from Continuous builds (Nov 27) and I'm not seeing the session object populated even when the Ti.Facebook.isLoggedIn() function returns true.

Incidentally the Ti.Facebook.userId does contain the right value for my facebook id.

here's my snippet

Ti.Facebook.addEventListener('login', function(e)
{
   Ti.API.info(Ti.Facebook.session['session_key']);
   Ti.API.info(Ti.Facebook.userId);
});    

Ti.Facebook.setup('<app_id>','<secret>',null,function(result) {
   if(Ti.Facebook.isLoggedIn()) {
      Ti.API.info(Ti.Facebook.session['session_key']);
      Ti.API.info(Ti.Facebook.userId);
   } 
});

The info are written but the value is null for the "session_key" and the correct value for "userId".

Can anybody see anything wrong or share some code on how to retrieve the session_key? I don't want to use a session proxy.

— asked November 28th 2010 by Daniel Arroyo
  • android
  • facebook
  • session
0 Comments

2 Answers

  • try asignning Ti.Facebook.session.session_key to a var and then showing that variable

    var data = Ti.Facebook.session.session_key;

    Ti.API.info(data);

    — answered December 17th 2010 by Gyasi Sutton
    permalink
    0 Comments
  • @daniel, did you ever figure this out? I'd like to not use a proxy as well, but it appears that the "login" event never fires?? Do you have any sample code you could post that successfully uses facebook without a proxy?

    — answered December 18th 2010 by Anthony Webb
    permalink
    3 Comments
    • In the source it looks like we also accept a 'secret' parameter, which is your Facebook application secret. But as a general rule this is frowned upon because your Facebook application's secret is shipped with your application. If decompiled, a malicious developer could get your app secret and masquerade as your application.

      You may want to scour the web for information on how to create a Facebook session proxy for your programming language - here's a tutorial for PHP. I'd love to be more help, but it looks like Facebook pulled their wiki-style docs and removed the guide for creating a session proxy. Awesome.

      — commented December 18th 2010 by Kevin Whinnery
    • How far out are we on being able to use the newer facebook oauth stuff? That or a janrain connector would be awesome!

      — commented December 21st 2010 by Anthony Webb
    • There are a few oAuth solutions people have been working on for Titanium. We just in the last day or so formalized a Twitter oAuth adapter that we are going to build out and use. As far as I know, there are no immediate plans to change the way our Facebook connect module works, so there would probably need to be a feature request made for that.

      — commented December 21st 2010 by Kevin Whinnery
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.