Я использовал API Magento для настройки веб-службы REST Magento.
Я использую платформу StrongLoop.
Установлено > npm oauth
Код: Выделить всё
var OAuth = require('oauth').OAuth;
var apiUrl = "http://domainname/api/rest/customers";
var oa = new OAuth(temporaryCredentialsRequestUrl, accessTokenRequestUrl, consumerKey, consumerSecret, 1.0, "http://localhost:3000/explorer", "HMAC-SHA1");
oa.getOAuthRequestToken(function(error, oauth_token, oauth_token_secret, results){
if(error) {
console.log('error');
console.log(error);
}
else {
// store the tokens in the session
oa.get(apiUrl, oauth_token, oauth_token_secret,
function (error, data, response) {
var feed = JSON.parse(data);
console.log(data);
});
}
});
{"messages":{"error":{ "code":401,"message":"oauth_problem=token_rejected"}]}}
Подробнее здесь: https://stackoverflow.com/questions/319 ... om-node-js
Мобильная версия