Last month, I have developed a tiny API that integrates a Java ME app into Facebook. The implementation was not a big deal, except the authentication process. Since Facebook uses OAuth 2.0, it requires that any app that wants to integrate into Facebook's services must authenticate via its web login page. We all know that displaying HTML page in Java ME is not a easy task, since we have no LCDUI component that renders HTML. Fortunately, LWUIT already provides that via HTMLComponent.
But how to accomplish that if my app is not based on LWUIT? Hard question, huh? In my case, fortunately, the app that I had to integrate into Facebook is based on eSWT, which provides a Browser component. Because that, I was able to access the Facebook's login page and track the whole process in order to retrieve the token access required to access the methods from Facebook API.
My point in this post is: how to integrate Java ME app into Facebook API without a browser component? What is the trick? Parser the web login page's content and simulate the form submission programmatically? How have you guys have done that?
In intend to release my Facebook API in a near future. So I would like to know a better approach to implement the authentication process, so this API do not get tied to any specific framework.
See you in the next post...