I need to allow my app to post certain messages in user's Facebook and Twitter walls. The idea is as simple as presenting one button, and once the user clicks on it, he is requested to log in in his Facebook account (no matters the way) and give my app writing privilegies, and my app will be able to publish a certain message (or at least my app should be able to check if the user posted that certain message later). The same for Twitter with another button.
Facebook SDK and Twitter SDK for Android seem too scary at first, and I just want to log in and publish a message when user clicks on a button. I've been researching, and Temboo library is really promising. I've tested it and I am able to publish in Facebook and Twitter without any problem, providing the credentials of my own accounts. The problem is the login step to allow users publish in their own accounts.
Following Temboo procedures, I try to make use of the Choreos InitializeOAuth and FinalizeOAuth. If I am not mistaken, InitializeOAuth returns a callbackURL that must be presented to the user to allow my app to publish or whatever. But how? Do I need to load that URL in a webview and then detect when the user logs in inside the webview? I have no idea. Temboo website and powerful seem amazing, but documentation lacks of an example as useful as the entire process of authentication in Facebook or Twitter in Android... :'(
The short version is that you're right about how you'd implement the OAuth flow in an Android application. At a high level, your application will:
The trick to #3 above is the ability to register custom URL handling schemes in Android, using "intent filters." In your AndroidManifest.xml file, you'll want to assign a custom intent filter to one of your activities, using code like this:
What this code means is that if your application receives a request for a url like "temboo://twitter" then that request will automatically be forwarded to the Activity that you specify -- in this case, MyOAuthActivity.
When you run the InitializeOAuth Choreo, you'll want to specify "temboo://twitter" (or whatever custom intent scheme you use) as the "forwarding URL" input. This will cause Temboo to forward the request back to your activity after the user clicks "Allow" in the OAuth webview.
In your Activity, you can then intercept URLs using your custom scheme, with code like this:
I work at Temboo by the way, so feel free to get in touch with any further questions you might have.