Ho passato la maggior parte di oggi a provare ad implementare l'API XAuth di Instapaper. Non sono ancora riuscito a ottenere un token oauth.API Instapaper e Javascript XAuth
Qualche idea su cosa sto facendo male?
Sto usando node.js e il modulo oauth. Sono a conoscenza del fatto che ho bisogno di passare il nome utente, la password, la modalità amd come parametri aggiuntivi. E il modulo oauth dovrebbe occuparsi di tutti i parametri oauth. Ma non lo è. Ecco il codice:
var OAuth = require('oauth').OAuth;
var oauth = new OAuth(
'',
'https://www.instapaper.com/api/1/oauth/access_token',
'CONSUMER_KEY',
'CONSUMER_SECRET',
'1.0',
null,
'HMAC-SHA1',
null
);
var extra = {
'x_auth_username': 'USERNAME',
'x_auth_password': 'PASSWORD',
'x_auth_mode': 'client_auth'
};
var hello = oauth._prepareParameters('', '', 'POST', 'https://www.instapaper.com/api/1/oauth/access_token', null);
var url = 'https://www.instapaper.com/api/1/oauth/access_token';
var f = true;
for (var i in hello) {
if (f) {
url += '?';
f = false;
} else {
url += '&';
}
url += hello[i][0] + '=' + hello[i][1];
}
console.log(url+'&x_auth_mode=client_auth&x_auth_username=&x_auth_password=')
oauth._performSecureRequest('', '', "POST", url+'&x_auth_mode=client_auth&x_auth_username=&x_auth_password=', null, null, null, function(error, data, response) {
console.log(error, data)
});
E restituisce questo:
{ statusCode: 401,
data: 'oauth_signature [pWRf4W9k9nogID/O90Ng29bR2K0=] does not match expected value [eqJ8zD1bKeUa3InpDyegGDAbSnM=]' } 'oauth_signature [pWRf4W9k9nogID/O90Ng29bR2K0=] does not match expected value [eqJ8zD1bKeUa3InpDyegGDAbSnM=]'}
sto ancora sbattere la testa contro questo . Per favore aiuto. –
Hai mai funzionato? Pubblicare una soluzione di lavoro o contrassegnare una soluzione come risposta corretta sarebbe ottima –