I'm trying to implement a little Javascript/PhoneGap utility that can post a tweet on twitter.
So far I've got this:
var authorize_url = 'https://oauth.twitter.com/2/authorize';
authorize_url += '?oauth_callback_url=' + encodeURIComponent(mycallbackUrl);
authorize_u开发者_运维百科rl += '&oauth_mode=flow_web_client';
authorize_url += '&oauth_client_identifier=' +*****;
authorize_url += '&response_type=token';
authorize_url += '&client_id' + *****;
This resulting URL will show me the twitter login screen, and after I login, the callback url is shown with two paramaters; oauth_access_token and oauth_bridge_code
So far so good, but the next part is confusing me.
Is this oauth_access_token I'm getting enough to do a tweet on behalf of the user? Or do I have to take further authentication steps? If not, how can I use the token in the call to http://api.twitter.com/1/statuses/update.json to actually post a tweet?
The twitter API docs can't help me out so all help is very much appreciated!
var mediaSource = "http://twitter.com/home?status={TITLE}";
mediaSource = mediaSource.replace('{TITLE}',"Text to share in Twitter");
window.location = mediaSource;
this may help you.
You are using an unsupported method of authentication that Twitter could change/break at anytime. It is recommended that you use the officially supported OAuth flow. https://dev.twitter.com/pages/auth
精彩评论