views:

75

answers:

1

I have an application that posts to multiple Twitter accounts by storing an array of usernames and passwords. Recently, Twitter updated their API so I have to authenticate using OAuth instead of storing credentials. How would I make the user authenticate for multiple Twitter accounts during a single process?

For example, I have a textbox with a submit button. When the user clicks on the submit button, I want the textbox value to post to user1, user2, and user3's Twitter account. This means they would have to be simultaneously logged into 3 accounts at the same time for this single click to work right? How is this possible?

PS -- I am doing this for Facebook too and is the same API / OAuth concept, which is why I tagged it with Facebook API as well.

A: 

The user doesn't have to be simultaneously logged into 3 accounts; but he does have to authorize your app thrice using different accounts.

See Twitter's OAuth FAQ - The access token does not expire. Once the user authorizes your app, you store the access token in your database. Then you just repeat the process all over again and store the next access token.

With Facebook, the tokens are short-lived, but you can request for the extended permission "offline_access". That would allow you to roughly achieve the same thing as twitter.

sri