Skip to content

Instantly share code, notes, and snippets.

@leovolving
Last active May 6, 2017 07:23
Show Gist options
  • Select an option

  • Save leovolving/3b702358bcd125206b5295a909fc057a to your computer and use it in GitHub Desktop.

Select an option

Save leovolving/3b702358bcd125206b5295a909fc057a to your computer and use it in GitHub Desktop.
Twitter API OAuth Parameters and Encryption
STEP 1: OBTAINING A REQUEST TOKEN
POST https://api.twitter.com/oauth/request_token
OAuth {
oauth_nonce,
oauth_callback,
oauth_signature_method: "HMAC-SHA1",
oauth_consumer_key,
oauth_signature,
oauth_version: "1.0"
}
RESPONSE {
oauth_token,
oauth_token_secret,
oauth_callback_confirmed
}
STEP 2: REDIRECTING THE USER
GET https://api.twitter.com/oauth/authenticate
{
oauth_token
}
RESPONSE {
oauth_token,*
oauth_verifier
}
*verify that it is the same as oauth_token received in step 1
STEP 3: CONVERTING THE REQUEST TOKEN TO AN ACCESS TOKEN
POST https://api.twitter.com/oauth/access_token
{
oauth_consumer_key,
oauth_nonce,
oauth_signature,
oauth_signature_method,
oauth_timestamp,
oauth_token,*
oauth_version: "1.0"
}
Content-Type: application/x-www-form-urlencoded,
oauth_verifier
*Added by signing process?
RESPONSE {
oauth_token,
oauth_token_secret
}
LIBRAIES/METHODS/DOCS {
HMAC-SHA1: https://www.npmjs.com/package/crypto-js,
Timestamp: Date.now(),
Nonce: {
https://www.npmjs.com/package/nonce,
https://www.thepolyglotdeveloper.com/2015/03/create-a-random-nonce-string-using-javascript/
},
Signature: https://dev.twitter.com/oauth/overview/creating-signatures
https://www.npmjs.com/package/node-twitter-api
https://webapplog.com/node-js-oauth1-0-and-oauth2-0-twitter-api-v1-1-examples/
https://coderwall.com/p/3mcuxq/twitter-and-node-js-application-auth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment