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 session proxy revisited.

This is not the question, but an answer, that I found after having to browse through the java source code. I hope it will be helpful to someone, and maybe the appcelerator team, after reading it, will take some steps to fix the issue, or at least document it.

After reading the answer to the following question, I was happy, because the proxy worked with iphone:

http://developer.appcelerator.com/question/32801/facebook-session-proxy-again

However, after trying it on Android simulator, it just crashed after trying to log in.

Well, the thing is that

  • THE DEFAULT RESPONSE FORMAT FOR FACEBOOK IS XML *

  • ANDROID DOESNT SUPPORT XML, BUT ONLY JSON *

Facebook does give you an option to receive JSON in the response, so we need to add one more parameter "format" to our parameters, for the proxy to work with Android:

$post = array('method' => 'facebook.auth.getSession',
'api_key' => $appapikey,
'v' => '1.0',
'format' => 'JSON',
'auth_token' => $_GET['auth_token'],
'generate_session_secret' => 1);

However, this doesnt work on iphone!!!
Looks like the iphone version of Facebook module doesnt expect JSON!!!

So for iphone you'll need the original version of proxy, or I dont understand something (maybe, you'll need a parameter, or I dont know), and for the android, u'll need to request facebook response in json format.

— asked August 4th 2010 by Anna Kozynenko
  • android
  • facebook
  • json
  • login
  • loginbutton
  • proxy
  • session
  • xml
1 Comment
  • Thank you so much for this! It works perfectly!! Just when I thought I wouldn't be able to include FB functions on the app I'm about to deploy, I find this.

    Simply, I have a FB proxy page for the iPhone users and one for the Android. Thank you very much!!!!

    — commented August 8th 2010 by Chris Dotson

2 Answers

  • Can you post your full proxy code. I made the suggested change and I'm still getting a blank login screen.

    Thanks in advance.

    — answered December 18th 2010 by Jesse Weaver
    permalink
    0 Comments
  • Can you post your full proxy code. I made the suggested change and I'm still getting a blank login screen.

    Thanks in advance.

    — answered December 18th 2010 by Jesse Weaver
    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.