I have a requirement for php script which works as below.The Database is having list of some 20 twitterIDs.Webapp should be able to post a tweet on behalf of any of the twitterID given in the list.This happens back-door that means no user interaction will be involved like redirecting to Twitter Authentication page to allow twitterApp to access some stuff and user will accept to allow access.User doesn't know about this back-end operation.
My questions is :
- Is this possible / feasible ?
- If possible, how should i approach the development roadmap . My technology is PHP based and involves REST APi integration to a smartphone client.
Looking forward for some deep explanation.
At some point the user will have to know about it, they will have to authorize your page the first time (you wouldn't want someone to post on your twitter feed without you knowing about it right?).
When they have authorized your page the first time, you can store the OAuth token you receive at the end of the authentication process and use it later on to post tweets, without asking the user to authenticate herself again, for as long as the token is valid.
You need more than just the twitter IDs to post on their behalf. They will have to authenticate the application first.
This generates two tokens
OAuthToken
andOAuthTokenSecret
, which can be stored in your database back-end and consequently, be used from your PHP back-end to post on behalf of the user, till the user deauthorizes your application, at which pointOAuthToken
won't function anymore.Twitter OAuthTokens do NOT expire, but the user can revoke your access.
You can implement the above in PHP using one of the Twitter PHP libraries