I'm currently trying to access Trello's private board using the Node.js web app. I want to get new cards. Unfortunately, I am stuck in the process of getting a token.
I use the node-oath library and paste it as follows:
var OAuth = require('oauth').OAuth, oauth = new OAuth('https://trello.com/1/OAuthGetRequestToken', 'https://trello.com/1/OAuthGetAccessToken', myKey, myOAuthSecret, '1.0', undefined, 'PLAINTEXT');
Then I try to get the token by calling:
oauth.getOAuthRequestToken(function (error, oauth_token, oauth_secret, results) { if (error) return console.log('1: ' + JSON.stringify(error)); oauth.getOAuthAccessToken(oauth_token, oauth_secret, function (error, oauth_access_token, oauth_access_token_secret, access_results) { if (error) return console.log('2: ' + JSON.stringify(error));
When I run this code, I always get the following error message:
1: {"statusCode":500,"data":"Invalid Signature"}
So, it is obvious that something is wrong with the first OAuth request. I saw that Trello also supports HMAC-SHA1. When I use it instead of PLAINTEXT, the first request succeeds, but the second does not, because I did not specify oauth_verifier.
Unfortunately, I have no idea how to provide this verifier. I read OAuth RFC , but it really didn't help me.
Basically, I really don't need HMAC-SHA1, PLAINTEXT will be fine.
Does anyone have any ideas what might be wrong?
PS: I read on the Trello developers board that there was once a mistake that prevented Trello from accessing the key sent inside the body, so they advised you to send it using the query string. But even if I changed the first code block to
var OAuth = require('oauth').OAuth, oauth = new OAuth('https://trello.com/1/OAuthGetRequestToken?key=' + myKey, 'https://trello.com/1/OAuthGetAccessToken', myKey, myOAuthSecret, '1.0', undefined, 'PLAINTEXT');
nothing changes: - /
Any ideas?