POST https://api.twitter.com/oauth/request_token
Header:
OAuth oauth_nonce="K7ny27JTpKVsTgdyLdDfmQQWVLERj2zAK5BslRsqyw", oauth_callback="http%3A%2F%2Fmyapp.com%3A3005%2Ftwitter%2Fprocess_callback", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1300228849", oauth_consumer_key="OqEqJeafRSF11jBMStrZz", oauth_signature="Pc%2BMLdv028fxCErFyi8KXFM%2BddU%3D", oauth_version="1.0"
oauth_callback
as an oauth_token
oauth_token=Z6eEdO8MOmk394WozF5oKyuAv855l4Mlqo7hhlSLik&oauth_token_secret=Kd75W4OQfb2oJTV0vzGzeXftVAwgMnEK9MumzYcM&oauth_callback_confirmed=true
Step 2: User Login: GET https://api.twitter.com/oauth/authenticate?oauth_token=<OAUTH TOKEN>
A callback is made to your initial callback with an oauth_token
and oauth_verifier
as parameters
Step 3: Get Token: POST https://api.twitter.com/oauth/access_token?oauth_token=<OAUTH TOKEN>&oauth_verifier=<OAUTH VERIFIER>
When should we make this call?
Response:
oauth_token=6253282-eWudHldSbIaelX7swmsiHImEL4KinwaGloHANdrY&oauth_token_secret=2EEfA6BG5ly3sR3XjE0IBSnlQu4ZrUzPiYTmrkVU&user_id=6253282&screen_name=twitterapi
require('url');
// ...
function (req, res) {
const queryObject = url.parse(req.url,true).query;
// this is now json
}
curl -XPOST
--url 'https://api.twitter.com/1.1/statuses/update.json?status=hello'
--header 'authorization: OAuth
oauth_consumer_key="oauth_customer_key",
oauth_nonce="generated_oauth_nonce",
oauth_signature="generated_oauth_signature",
oauth_signature_method="HMAC-SHA1",
oauth_timestamp="generated_timestamp",
oauth_token="oauth_token",
oauth_version="1.0"'
POST https://api.twitter.com/oauth2/token
Authorization Basic <INPUT>
application/x-www-form-urlencoded;charset=UTF-8
grant_type=client_credentials
<INPUT>
is the Base-64 encoded app consumer key concatenated with a colon, concatenated with the consumer secret.
Response:
{"token_type":"bearer","access_token":"AAAA..."}
Authorization: Bearer <KEY>