Gadi
Gadi

Reputation: 482

Facebook Connect for BlackBerry

I'm looking for a solution similar to the iPhone Facebook Connect (https://github.com/facebook/facebook-ios-sdk) for the BlackBerry platform. Basically, I need my users to authenticate against Facebook from within a native BlackBerry application (so, not a Web based mobile application). Is there a library I could use, and if not, what will be the correct approach to achieve this?

Thanks in advance!

Upvotes: 5

Views: 7081

Answers (3)

Maksym Gontar
Maksym Gontar

Reputation: 22775

Options for BlackBerry are:

Upvotes: 4

Guy Ephraim
Guy Ephraim

Reputation: 3520

Afzal, I had a similar problem and I've found out that I actually had a problem with my connection string. You can look at the following link there is some explanation and code for creating the correct connection string http://www.localytics.com/blog/post/how-to-reliably-establish-a-network-connection-on-any-blackberry-device/

and just add the connection string to the FetchThread where it opens the connection:

connection = (HttpConnection)Connector.open(absoluteUrl+getConnectionString());

Upvotes: 1

Eki
Eki

Reputation: 571

I managed to go through Facebook Connect authentication within my BB app. After cracking my head for three days I realised that it is the URL that is the culprit!

Basically these are what you need (assuming you are developing for 4.5 platform):

  1. Using Browser Field, do a POST to http://m.facebook.com/login.php (the mobile version of Facebook) passing all the necessary arguments as per the Desktop application counterparts (one challenge is to get the signature generation correct).
  2. Once the User successfully grants access, capture the URL of the success screen. You will obtain your auth_token.
  3. Do a POST to the REST server to obtain the session key and secret given the auth_token you obtain.
  4. Save the returned session key and secret, persist it, and wholla! your app is up and running.

I am developing a custom LoginScreen and FacebookFacade object to incorporate the first three steps above, if anyone is ever interested to reuse my code. It'll be GPLed, I suppose ;)

Upvotes: 3

Related Questions