views:

1833

answers:

10

Hi

I'm looking for a solution similar to the iPhone Facebook Connect (http://wiki.developers.facebook.com/index.php/Facebook%5FConnect%5Ffor%5FiPhone) 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!

+2  A: 

As you can see in Facebook Platform for Mobile, options for BlackBerry are:

Other option is try to port JavaFB from J2SE to J2ME

Max Gontar
Coldice - thanks. While the SMS interaction API and the FB Connect for Mobile Web do not answer my needs, I think the option of porting the JavaFB would work (I found an even closer project - http://fbconnect-android.googlecode.com/ Android Facebook), I'll try that approach.
Gadi
You're welcome!
Max Gontar
+3  A: 

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 ;)

Eki
Hiii...it will be very greatful if u can provide me with a glimpse of yuor code...my email id is [email protected]
tek3
One thing more i want to ask...how to capture the URL of the success screen in order to obtain auth_token...
tek3
Using BrowserContent you can capture the URL with getURL() and parse the response accordingly. I will post the complete code shortly as I am tidying it up a bit.
Eki
I have posted the codes here http://www.baskoro.web.id/facebook-connect-blackberry-HOWTO.html
Eki
A: 

Wow, that's great - just wondering - out of interest, how did you manage to get over the problem that after the user has logged in, they end up on their home page (with your app sitting in the background)? Very interested in your code base when it's available...

A: 

I tried it on Bold 9000. It doesnt do anything when I press "Connect" button on m.facebook login page.

If I enter wrong ID/Password, It says Invalid user name or password but nothing happens when I enter the correct credentials and press connect. I have experienced the exact same issue when I just opened m.faebook.com web site from inside a web field. What am I missing here ?

Afzal

Afzal
+1  A: 

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());

Guy Ephraim
A: 

Guy Ephraim,

As I have mentioned, all other links in the Facebook connect page works except login button WHEN entered correct email and password.

I am using ";inteface=wifi" in every URL. I have no idea whats wrong. Please help.

Afzal

Afzal
OK I think now it works (I added connection string to FacebookFacade class as well). I see the screen with "Friends List" button but when I debug it, the application does not have a "secret" from facebook. It has "session_key" but no secret has been returned by facebook. The response I get is like:"session_key":"XXXXXXXXXX-XXXX","uid":XXXXX,"expires":0,"base_domain":"ABC.com"but no secret ! is it all right? what if I need a secret as well ? can I get that ?
Afzal
Did it !I added a parameter arguments.put("generate_session_secret", "true"); in getSession(String token) and removed session_secret from signature.Thanks guys you all have been a GREAT help !!Afzal
Afzal
A: 

Hi all, Me again. I am facing issues for this facebook connect to get extended permissions. How to do that? the Blackberry browser field does not show the permission popups!

Please help !

Afzal

Afzal
And it redirects me to success page after the first login...doesnot ask for permissions...
Afzal
A: 

hi i was using the code from http://www.baskoro.web.id/facebook-connect-blackberry-HOWTO.html

It was working previously. But just from today after login I see a page with string success written. In the url i don't get the auth_token. So I had to stay in that page. And it shows an error message.

The application gets permitted and i can see in my facebook application settings. Did facebook change anything?

regards

shimul
A: 

Hi, I was using the code from http://www.baskoro.web.id/facebook-connect-blackberry-HOWTO.html as well. I get the login screen and I enter my username and password. Once I do I get a white blank screen with Success written on it. Beyond that nothing happens. Any idea whats going on?

Hi, even i m facing the same issue. Can you please let me know if you have found out the solution?
sunil
A: 

any more updates?? am also facing the same problem.

PraveenGoparaju