How do I make an OAuth Echo tweeter request?

I use this npm package to check OAuth Echo users regarding twitter: https://github.com/ciaranj/node-oauth

Does anyone have an example of using this package to verify user credentials?

I get the X-Auth-Service-Provider and X-Verify-Credentials-Authorization from the iOS app correctly, as far as I can tell, but I'm having problems using these headers with this package.

Here's the OAuthEcho constructor:

var oauthEcho = new OAuthEcho( "https://twitter.com", "https://api.twitter.com/1.1/account/verify_credentials.json", app.config.twitter.consumer_key, app.config.twitter.consumer_private_key, "1.0A", "HMAC-SHA1" ); 

Any help would be really appreciated!

Thanks!!

+5
source share
1 answer

WOW, I did all this wrong. I really don't need the oauth module. I need a request module to make a simple GET call for twitters api.

 // Setup the request object for OAuth Echo to twitter var options = { url: 'https://api.twitter.com/1.1/account/verify_credentials.json', headers: { 'Authorization': req.headers['x-verify-credentials-authorization'] } }; // Make the request request(options, function (error, response, body) { if (!error && response.statusCode == 200) { // If twitter responds with a 200, the echo call was authorized // TODO: do stuff next(); } else { res.send(401, 'Unauthorized'); next(); } }); 
+8
source

Source: https://habr.com/ru/post/1208987/


All Articles