I need to protect secret validation tokens and have no idea of how to do this. Does anyone know how I can protect my personal credentials on NetSuite?
Any help would be greatly appreciated thanks
I need to protect secret validation tokens and have no idea of how to do this. Does anyone know how I can protect my personal credentials on NetSuite?
Any help would be greatly appreciated thanks
You can store credentials as JSON in the file cabinet.
Create a directory and mark it as private so that only you care able to view its contents.
Then upload the key file to that restricted directory, take note if the fileId
.
To use the file, just load it into your script and use it as you would for any OAuth process. Just make sure not to log any of the variables! These are stored in system notes.
const authKeyfile = file.load({id: 123456}).getContents();
const authKeyJSON = JSON.parse(authKeyfile)
// OAuth signing etc...
Try storing the Tokens/API Keys as API Secrets i.e. see NetSuite's API Secrets page.
The createSecureString()
function from the N/https module worked for me. Example below.
var myAPIKey = https.createSecureString({ input: '{custsecret_my_api_key}'})