I'm currently trying to access a private Trello board using a Node.js web application. What I want to achieve is to create new cards. Unfortunately, I'm stuck in the process of receiving a token.
I use the node-oath library and embed 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');
Afterwards, I try to get a 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, obviously there is something wrong with the first OAuth request. I've seen that Trello also supports HMAC-SHA1. When I use it instead of PLAINTEXT, the first request succeeds, but the second fails as I have not specified an oauth_verifier.
Unfortunately I do not have the slightest idea of how to provide this verifier. I've read the OAuth RFC, but that didn't really help me.
Basically, I do not actually need HMAC-SHA1, PLAINTEXT would be fine.
Does anybody have an idea what might be wrong?
PS: I've read on the Trello developer board that once there was a bug which did not allow Trello to access the key sent within the body, so they advised you to send it using the query string. But even if I change the first codeblock 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');
it doesn't change anything at all :-/
Any ideas?