Socket
Socket
Sign inDemoInstall

nsoauth1

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nsoauth1

Generate your NetSuite Token Based Authorization Header


Version published
Weekly downloads
306
decreased by-14.53%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

nsoauth1

Generate your NetSuite Token Based Authorization Header

Introduction:

This module allows to create an OAuth1 header string that you can later use to inject to REST calls to netsuite

Supported Methods

  • Generate OAuth header data

Methods

  • generateOAuth()

Installation

Open a terminal and enter the following command:

npm install nsoauth1 --save

Usage

Example of GET request

const NetsuiteOAuth = require('nsoauth1');

const method = 'GET';
const url = 'https://123456-sb1.restlets.api.netsuite.com/app/site/hosting/restlet.nl?script=508&deploy=1';
const consumerKey = 'consumer-key';
const consumerSecret = 'consumer-secret';
const tokenId = 'token';
const tokenSecret = 'token-secret';
const account = 'Netsuite Account';

let oauth = new NetsuiteOAuth({ method:method, 
                     url:url, 
                     ck: consumerKey, 
                     cs: consumerSecret, 
                     tk: tokenId, 
                     ts: tokenSecret, 
                     realm: account });


let resp = oauth.generateOAuth();

/*
Output example:

{
  timestamp: 1625338429,
  nonce: 'qlpEJNNmmhTJxAVVFWCGJpuIlmIiLuTW',
  baseString: 'GET&https%3A%2F%2F123131321.netsuite.com&oauth_consumer_key%3Dadasda2324232dasd2342%26oauth_nonce%3DqlpEJNNmmhTJxAVVFWCGJpuIlmIiLuTW%26oauth_signature_method%3DHMAC-SHA256%26oauth_timestamp%3D1625338429%26oauth_token%3Dadsadssdsa78dy834hr3f8943%26oauth_version%3D1.0%26script%3D1',
  signature: '0qcbJLGEBDoQj%2FsK8qlQuTbdHjIgRiAtSZEoMGPya2M%3D',
  authHeader: 'OAuth realm="1231231321", oauth_consumer_key="adasda2324232dasd2342", oauth_nonce="qlpEJNNmmhTJxAVVFWCGJpuIlmIiLuTW", oauth_signature="0qcbJLGEBDoQj%2FsK8qlQuTbdHjIgRiAtSZEoMGPya2M%3D", oauth_signature_method="HMAC-SHA256", oauth_timestamp="1625338429", oauth_token="adsadssdsa78dy834hr3f8943", oauth_version="1.0"'
}

*/

Keywords

FAQs

Last updated on 28 Oct 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc