I'm building a chrome extension for tumblr. I'm doing the oauth part using the library jsoauth, but I'm getting a 401 error.
The exact error being, "oauth_signature [D6rDCSn/ClGhMyTq24/c6419t8I=] does not match expected value [wnrVNhZYCSfRmKSTaKyb9dg7vNQ=]"
I have no idea what's causing it. Here's the code I have:
Background.html
<html>
<script type="text/javascript" src="jsOAuth-1.3.6.min.js"></script>
<script type="text/javascript" src="background.js"></script>
</html>
background.js
function getAccess(){
var oauth, options;
options = {
consumerKey: 'KEY',
consumerSecret: 'SECRET',
requestTokenUrl: "http://www.tumblr.com/oauth/request_token",
authorizationUrl: "http://www.tumblr.com/oauth/authorize",
accessTokenUrl: "http://www.tumblr.com/oauth/access_token"
};
oauth = OAuth(options);
oauth.fetchRequestToken(openAuthoriseWindow, failureHandler);
function openAuthoriseWindow(url)
{
var wnd = window.open(url, 'authorise');
oauth.setVerifier(false);
oauth.fetchAccessToken(output,failureHandler);
function output(url)
{
console.log("success!");
}
}
function failureHandler(data)
{
console.error(data);
}
}
chrome.extension.onMessage.addListener(
function(request, sender, sendResponse) {
if (request.greeting == "getAccess"){
sendResponse({farewell: "It worked"});
getAccess();
}
});