Skip to content

Instantly share code, notes, and snippets.

@jlaustill
Last active November 1, 2018 09:59
Show Gist options
  • Save jlaustill/d726407f3d74b3115e0f4d18fc5bc15c to your computer and use it in GitHub Desktop.
Save jlaustill/d726407f3d74b3115e0f4d18fc5bc15c to your computer and use it in GitHub Desktop.
The first step in getting a token from Magento 1.x REST API
var request = require('request');
var consumerKey = '57d84828608840c7dbaa637f2f66ee13',
consumerSecret = "82fbea317ff08682cdd73d9eb242f0c7",
siteUrl = "http://dev.yoursite.com";
// step 1
var qs = require('querystring'),
oauth = {
callback : 'http://thisis.broken/callback/',
consumer_key : consumerKey,
consumer_secret : consumerSecret
},
url = siteUrl + '/oauth/initiate';
request.post({
url : url,
oauth : oauth
}, function (err, req, body) {
// All we need from this is the returned oauth_token and oauth_token_secret
console.log(body);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment