Android Twitter OAuth that REALLY work? - android

Any Example suggestion that really works currently with Twitter OAuth?
I just need a simple API to post from an Android App, no need for something fancy and full feature, something that just works fine for authentication, doesn't crash and can update status.
I tried at least 4 examples poested before, all of them fail at some point.
Regards,

I had success with the Twitter4J library. For my purposes the login credentials were hardcoded into my app though. It was not a situation where each user could log in to their own twitter account. But the library was very easy to use for retrieving statuses and posting a tweet.

Related

Twitter OAuth with Android, from REST 1.0 without Login to REST 1.1 with Login

I have an app, that uses the public part of the Twitter API, the one which does not require a login, but with the update, the login is required, so I need to implement OAuth. I've seen there are libraries like Twitter4j who makes this easier, but my app has a lot of code, and I don't want to rewrite it, not now, so I've think to use SCRIBE or oauth-signpost, but I don't really know how to.
I've read a lot of webs tutorials, and github projects but they don't work for me (maybe I'm stupid).
I've being thinking in the next things, correct me if I'm wrong.
An initial activity with the login button, only a button, who shows
a web view with twitter.
Shared preferences of the Token y Token Secret.
A Little change on my get json function, in the HTTPclient, if I'm not wrong which passes a header with the token, token secret, app key and app key secret.
After a week of reading, I think that I understand how it works, but I can't do even a simple new project make a connection.
I know that I should made 3 petitions if I'm not wrong, and after the second, open a webview with a link that is in the second request, an is there where the user logs in.
With the different alternatives, I think that the best option for what I want to do, is oauth-signpost, but I can't find examples, I found a few, but they crashed...
If anyone could help me with this, a little explanation, or an example, but a simple thing, because I'm losing my mind, and I can't continue because the API 1.0 is going to be deprecated soon.
You should check out Temboo. It simplifies the OAuth process for a number of APIs, including Twitter. It works like this:
Run the InitializeOAuth step. This returns an authorization URL that you can show to your users. They need to follow the instructions on this page to authenticate with your app.
Run the FinalizeOAuth step. This takes as input the callback ID that your user generated when they authenticated via the URL you showed them in the previous step. The result of this step is the access token you need.
Full details here: https://www.temboo.com/library/Library/Twitter/OAuth/
Also, you can play with, and see source code for, how Temboo simplifies OAuth for Facebook here. The twitter support works the same way.
(Full disclosure: I work at Temboo)

Authentication using Facebook via Rails API

Users of my Rails app can authenticate in one of these 2 manners:
Using their Facebook account
Using our own authentication
I'm using Facebook SDK on Android and devise and omniauth on Rails.
How do I authenticate against my Rails app on Android so I can then fetch the information I need from the server?
NB: I've noticed this question is getting a fair amount of views recently. Please don't follow the advice given in this thread too closely -- the web moves fast and it dates from 3 years ago!
This can be done using the fb_graph gem (not fbgraph!).
You can just add it to your gemfile and do
user = FbGraph::User.me(token).fetch
where token is the oauth token you got by using, for example, the Facebook SDK on Android.
user.email will be the user's email address (if you set up the necessary permissions).
You can use this URL for testing:
https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=https://www.facebook.com/connect/login_success.html&response_type=token
That totally depends on how your authentication system works. You will need to create an API on your server to handle communication from the Android app and pass information between both using the API.
Niraj Shah is completely right, though the answer might not be detailed enough for you. For an in-depth answer to your question, have a look at Securing an API railscast by Ryan Bates that has been released only recently. It covers HTTP Basic Auth.
You might also want to have a look at the more advanced option to secure your API / provide registered users access to their data. There's a railscast about this one as well here: http://railscasts.com/episodes/353-oauth-with-doorkeeper - though it's a pro episode, so you need to sign up for it in order to watch it.
Francisco, I have the exact same need.
The devise scenario using token_authenticatable seems straightforward and shouldn't be a problem but I'm not sure the best way to handle the Facebook scenario. On the web side, for FB auth I'm using omniauth-facebook as documented here: https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview. I think this uses OAuth with FB as a provider so it's a good possibility that the latest RailsCast about doorkeeper securing an API with OAuth should do the trick. I haven't tried it yet but will do so soon unless you beat me to it. Here is the link: http://railscasts.com/episodes/353-oauth-with-doorkeeper.

Android Facebook howto Post

i have the following problem: I tried to post sth. to Facebook by using ACTION_SEND Intent to pass a String to the Facebook application.
Now I know this is currently not possible.
I don't want to code my own Facebook login, logout, session handling stuff in my application.
Question is:
If someone has the Facebook App installed and is logged in,
can I use the authentification information to post sth. on his Facebook wall?
Or, what is the easiest way to get sth. posted?
thanks
I would recommend using the Spring Social Facebook library. It will take care of all the OAuth stuff for you and provide you with a nice Facebook API you can interact with. The API allows you to do a lot more things than just post.
The downside is you have to install the jar files with your app and do a little setup. There is a good example of how to do this for Android in the spring-android-showcase-client in the spring-android-samples project.

twitter in android

Is there any SDK of Twitter available through which we can implement Twitter in our application? I want that my application would load on his/her Twitter account and then the tweet should be sent to his/her account, but I cannot find any simple examples.
Something like the Facebook Android SDK is what I'm look for.
You can use twitter4j. This site also contains some usage examples.
Unfortunately with the introduction of oAuth, login is no longer trivial. You have to register your application with Twitter (go to your account, then applications and add the app there). This will give you a consumer key/token pair, that you need for logging in and that you need to keep secret.
I've implemented this in my Android-Client called Zwitscher.
You can have a look at the Login procedure in the LoginActivity (of the v0.65 tag).
If you just want to post a tweet to twitter, use the Android SEND Intent. That way, the user can choose what he want's to do with the post himself. It's much easier for you as well. No worrying about OAuth etc.
As #Heiko said, twitter4j is quite good. You should use it.
For an example of how it works, I have created a simple sample app that can be found here.
Check that out, maybe it helps you.
AFAIK there is no sdk provided for twitter. You can however use XAUTH for twitter.
It is fairly easy to implement it.
This post might be able to help you.
xAuth Authentication for Twitter Share in Android?

twitter oath authentication android

i am developing app.its having post message on facebook and twitter.i searched on net and got many example but i confused with twitter.
if i am using oath authentication how should i provide login screens for clients.many example
what i found just they are using consumer and secret key where i need to pass uname,pword
can you pl suggest me its very urgent to me
Thanks in advance
Aswan
Twitter using oAuth at present, so whatever api's you will get, they will open the official twitter login page in webview, so you cannot use your own login page for that, twitter does not want's that........Hope it help's youGood luck.......
I've done this using a WebView (to hold the login UI which comes from twitter.com) and Signpost for the OAuth authentication. There's a good example here.
However, this turned out to be a less than brilliant mobile user experience - WebView login screens just suck - so I switched to using XAuth instead of OAuth, which you have to apply to Twitter for. The benefit of doing that is that you can have your own custom login UI, which isn't web-based. Unfortunately Signpost doesn't yet support XAuth so I also changed to using a stripped-down version of JTwitter.
If you are interested in using Singpost and Android's HttpURLConnection to obtain access token based on username and password you can have a look at my post. I was referring to Twitter XAuth so that's should be what you looking for. It works for me.
http://3citydev.blogspot.com/2013/05/how-to-obtain-xauth-access-token-using.html

Categories

Resources