6

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

jk121960
  • 843
  • 14
  • 45
  • That is a bit vague as to what credentials need to be stored for what purpose. – Brian Oct 13 '20 at 19:15
  • It would be the secret value for credential evaluation in a public/private authentication. So I need to send information to another endpoint outside of NetSuite, that endpoint uses OAuth 1, where can I store the secret of the pair? thanks in advance for any help – jk121960 Oct 21 '20 at 04:22
  • does nobody have any ideas about this? I would think this has occurred before. Any help is greatly appreciated, thanks – jk121960 Oct 26 '20 at 05:18

2 Answers2

3

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.

Create Document Folder

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...
user809
  • 92
  • 2
0

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}'})
Tyler2P
  • 2,324
  • 26
  • 22
  • 31