Search code examples
oauthtumblradonis.js

Tumblr - oauth_signature does not match expected value


There are already topics on this topic, but I have not been able to solve the problem on my side.

I develop a driver of auth for AdonisJS Ally and Tumblr, I get this error after the callback. However, oAuthToken, requestToken.oAuthTokenSecret and oAuthVerifier are correct (at least, I think).

The response is:

error { statusCode: 401, data: 'oauth_signature does not match expected value' }

The request token URL:

https://www.tumblr.com/oauth/request_token?oauth_consumer_key=Vv3XfKpkZAXAehLxk9h76cjPkUyq7iDnqMjmEKwqKrOriGSVoG&oauth_nonce=fd47a26a06ceb6ce20121bc98ac78a01&oauth_signature=Hkhvn1n5kgjg9P0IeKwvqKT9j3I%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1323327331&oauth_version=1.0


Solution

  •     var request = require("request");
    
    var oauth ={
             consumer_key: "****************************", 
             consumer_secret: "****************************"
    };
    var url = 'https://www.tumblr.com/oauth/request_token'
    request.post({url:url, oauth:oauth}, function (e, r, body) {
        var temp1 = body.split("&");
       var auth_token=temp1[0].split("=")[1];
       var auth_secret=temp1[1].split("=")[1];
       var tokens=[auth_token,auth_secret];
        console.log(temp1)
        cb(undefined,{d:tokens});
    })
    

    this code worked to me, try this. There is no proper documentation for tumblr, but from the doc what i understood is there are 3 ways to get authenticated in tumblr and receive auth_token and auth_token secret the above code might not work because there is change of auth_nonce and auth_signature and hence you receive the error as oauth_signature does not match expected value so i would suggest to use my method to generate the auth_token and auth_token_secret. this code works without adding any signature and nonce