How can I allow a user to post to Twitter from my JavaScript / PhoneGap application?

I am trying to implement a small Javascript / PhoneGap utility that can post twitter on twitter.

So far I have this:

var authorize_url = 'https://oauth.twitter.com/2/authorize';
authorize_url += '?oauth_callback_url=' + encodeURIComponent(mycallbackUrl);
authorize_url += '&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 logging in, the callback URL will be shown with two parameters; oauth_access_token and oauth_bridge_code

So far so good, but the next part confused me.

Is this oauth_access_token? Am I getting enough to tweet because of user? Or do I need to take additional authentication steps? If not, how can I use a token in a call to http://api.twitter.com/1/statuses/update.json to post a tweet?

The twitter API docs can't help me, so all help is much appreciated!

+3
source share
2 answers

You are using an unsupported authentication method that Twitter could change / break at any time. It is recommended that you use an officially supported OAuth stream. https://dev.twitter.com/pages/auth

0
source
var mediaSource = "http://twitter.com/home?status={TITLE}";
mediaSource = mediaSource.replace('{TITLE}',"Text to share in Twitter");

window.location = mediaSource;

it can help you.

+1
source

All Articles