nauthio
v1.0.1
Published
JavaScript Library for NetSuite Auth 1.0
Downloads
3
Maintainers
Readme
nauthio
JavaScript Library for NetSuite Auth 1.0. This library goal is to help speed up the setup of the authentication steps needed to set Token-Based Authentication with the NetSuite ERP System.
Installation
Requirements:
- Node.js
- npm (Node.js package manager)
npm install nauthio
Usage
Modular include:
const Nauthio = require('nauthio');
Build the NetSuite Config Object which contains the authenticaion and request details
const nsConfig = {
url: 'https://<account>.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=100&deploy=1',
realm: '<ACCOUNT>',
action: 'POST',
tokenId: '55fe716',
tokenSecret: '9730db3',
consumerKey: '99cf05a',
consumerSecret: '1886909'
};
Create a new Nauthio instance with the config object
const auth = new Nauthio(nsConfig);
Use the method .getOAuth. It'll use the config data
const oAuth = auth.getOAuth();
The .buildHeader() methods returns the header
const header = auth.buildHeader(oAuth);
const authHeader = {
'Authorization': header,
'Content-Type': 'application/json'
};
Pass the header to the respective request.
Statistics
Social