Twitter.getAccessToken()

Generate a new access token for acting on behalf of a particular Twitter user account.

This machine should be used from your Twitter "webhook" (i.e. not exactly a true webhook, but the "callback route" that Twitter will redirect the user back to based on the `callbackUrl` you specify. Note that this redirect URL will have bundled two values: "oauth_token" and "oauth_verifier" -- both of which should be passed to this machine in order to get the access token. The access token returned by this machine can be used to authorize your subsequent requests to the Twitter API, allowing you to access/act on behalf of this particular user's Twitter account.)

Usage

Hover over inputs/exits for more info.

var Twitter = require('machinepack-twitter');


// Generate a new access token for acting on behalf of a particular Twitter user account.

Twitter.getAccessToken({

oauthToken: 'UL1866Vlkl0aZyPw2Kd2u592D17Xl1uE',

oauthVerifier: 'xEj5XxGFWe6vPiJFofYgVMZjw6eVc6Mw',

: ,

: ,

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

oauthToken required

The token generated by Twitter and provided to the callbackUrl as "oauth_token".

'UL1866Vlkl0aZyPw2Kd2u592D17Xl1uE'
oauthVerifier required

The verification code generated by Twitter and provided to the callbackUrl as "oauth_verifier".

'xEj5XxGFWe6vPiJFofYgVMZjw6eVc6Mw'
undefined

undefined

Exits

error

An unexpected error occurred.

success

OK.

{ accessToken: '847489329-998DSdafaasdDSF08asdfda08agf6ad6fsdaa08dasdaf76sa5',
  accessSecret: 'SDFSssdfsdf9&SDfSDFSDFSfd9877ssdf',
  screenName: 'johngalt',
  userId: '54952598' }