NetSuite Token Based Authentication Module
npm install netsuite-tba-oauthGET (get function)
POST (post function)
PUT (put function)
Open a terminal session and enter the following command:
`npm install netsuite-tba-oauth --save
Example of GET request
`javascript
const NetSuiteOauth = require('netsuite-tba-oauth');
const url = 'restlet-url';
const method = 'GET';
const consumerKey = 'your-consumer-key';
const consumerSecret = 'your-consumer-secret';
const tokenId = 'token-id';
const tokenSecret = 'token-secret';
const account = 'account Id';
const oauth = new NetSuiteOauth(url, method, consumerKey, consumerSecret, tokenId, tokenSecret, account);
oauth.get().then(response => console.log(response));
`
Example of POST request
`javascript
const NetSuiteOauth = require('netsuite-tba-oauth');
const url = 'restlet-url';
const method = 'GET';
const consumerKey = 'your-consumer-key';
const consumerSecret = 'your-consumer-secret';
const tokenId = 'token-id';
const tokenSecret = 'token-secret';
const account = 'account Id';
const oauth = new NetSuiteOauth(url, method, consumerKey, consumerSecret, tokenId, tokenSecret, account);
const data = {key: 'value'};
oauth.post(data).then(response => console.log(response));
``