This project has moved and is read-only. For the latest updates, please go here.

How to persist data authentication?

Feb 16, 2010 at 4:05 PM

I have looked in the documentation and Google but could not solve my problem.

I am creating an application where the twitter twitter application to send messages to registered users. The name of my application and twittername her are called Tuitq (@ tuitq)

For testing I was using the UsernamePasswordAuthorization and entering the User and password. Thus the UserAgent is not personalized. For example, when sending tweets, messages are written as "from API". To have UsertAgent as the name of my application ("from Tuitq") need to authenticate with the OAuth.

Using the examples available in the project, I was able to authenticate the form InMemoryTokenManager with WebOAuthAuthorization and works perfectly for users of my application. I'm not storing the data authentication. Each time the application users enter the system they must authenticate again.

But the User of my application (@ tuitq) must authenticate automatically without having to enter the User and password to send tweets to the registered users in the system. I think I should store the database data that User Authentication OAuth and every time you need to authenticate the User @ tuitq I get the authentication data and authentic without being redirected to the OAuth on Twitter.

How do I make this automatic login?

How and what should I store the database to get this automatic authentication of User tuitq @?

As I place this automatic login again after obtaining the authentication data automatically?




Feb 17, 2010 at 2:06 PM

It sounds like you want to use OAuth, but don't want users to have to authorize Twitter every time they use your app.  Is that right?

Assuming that's right, the task you have to do is stop using InMemoryTokenManager and use your own class that implements the same interface.  Your own implementation should store the tokens in your application's persistent store.  And store the access tokens' affiliation with the right user.  Then users will only have to authorize your app once.


Mar 25, 2010 at 11:53 PM
Also, as of changeset 64963, you can can read the OAuth token from the authorization instance and save that away.