TL;DR: the version of this lib on npm is out of date with respect this repo's oauth2example and this Intuit blog post. Solution is to release current version of this repo to npm.
Figured out why this doesn't work outside the oauth2example/ directory. Given this minimal example:
var QuickBooks = require('node-quickbooks')
// var QuickBooks = require('../index');
var qbo = new QuickBooks(consumerKey, consumerSecret, token, false, realmId, true, false, 4, '2.0')
qbo.findAccounts((error, data) => error ? console.error(error) : console.log(data.QueryResponse.Account.slice(0, 1)))
Running the script yields the following (incorrect) response (note the AUTHENTICATION error):
An easy way to tell whether you're using the OAuth2 capable version is to see if it exposes QuickBooks.setOauthVersion. What npm install node-quickbooks installs doesn't have that method.
TL;DR: the version of this lib on npm is out of date with respect this repo's oauth2example and this Intuit blog post. Solution is to release current version of this repo to npm.
Figured out why this doesn't work outside the oauth2example/ directory. Given this minimal example:
Running the script yields the following (incorrect) response (note the AUTHENTICATION error):
but when we switch the
require
statement to the commented out one that references the../index
, this is the (correct) response:An easy way to tell whether you're using the OAuth2 capable version is to see if it exposes
QuickBooks.setOauthVersion
. Whatnpm install node-quickbooks
installs doesn't have that method.