dbaghdanov
09/15/2021, 9:54 PMdefine(["N/runtime", "N/https"],
(runtime, https) => {
const get = (requestParams) => {
let secureString = https.createSecureString({
input: '{custsecret_my_custom_secret}' // <<- another thread here suggested this format with the '{secret_id}'
});
let body = {
test: 'test',
secret: '{'+secureString+'}',
, key1: "custsecret_my_custom_secret"
, key2: 'custsecret_my_custom_secret'
, key3: '{custsecret_my_custom_secret}'
};
let response = <http://https.post|https.post>({
body: JSON.stringify(body),
url: "<https://my.domain.com/v1/endpoint>",
credentials: ['custsecret_my_custom_secret'], // <<- i've also tried wrapping in {} too
headers: {
Authorization: "Basic abcdefghijklmnopqrstuvwzyz=",
'Content-Type': "application/json",
Accept: '*/*'
}
});
}});
This is the body I capture on the other end:
[
{
"test": "test",
"secret": "{
https.SecureString
}",
"key1": "custsecret_my_custom_secret",
"key2": "custsecret_my_custom_secret",
"key3": "{
custsecret_my_custom_secret
}"
}
]
battk
09/15/2021, 9:56 PMbattk
09/15/2021, 9:57 PMdbaghdanov
09/15/2021, 9:57 PMdbaghdanov
09/15/2021, 9:59 PMhttps.SecureString
An https.SecureString is returned by https.createSecureString(options), SecureString.appendString(options), and SecureString.appendSecureString(options). It can also be used as the options.credentials parameter in a call to https.request(options).
battk
09/15/2021, 9:59 PMbattk
09/15/2021, 9:59 PMdbaghdanov
09/15/2021, 9:59 PMbattk
09/15/2021, 10:00 PMdbaghdanov
09/15/2021, 10:00 PMsecret: '{'+secureString+'}',
battk
09/15/2021, 10:00 PMbattk
09/15/2021, 10:00 PMdbaghdanov
09/15/2021, 10:03 PMbattk
09/15/2021, 10:05 PMbattk
09/15/2021, 10:06 PMbattk
09/15/2021, 10:06 PMdbaghdanov
09/15/2021, 10:10 PMdbaghdanov
09/15/2021, 10:10 PMbattk
09/15/2021, 10:13 PMbattk
09/15/2021, 10:14 PMbattk
09/15/2021, 10:16 PMJSON.stringify(body)
in the input of your secure stringbattk
09/15/2021, 10:17 PMbattk
09/15/2021, 10:19 PMdbaghdanov
09/16/2021, 12:13 AMdbaghdanov
09/16/2021, 12:15 AMlet body = {
test: 'test',
secret: '{custsecret_my_secret}'
};
let secureString = https.createSecureString({
input: JSON.stringify(body)
});
let response = <http://https.post|https.post>({
body: secureString,
url: "<https://httpbin.org/post>",
credentials: ['custsecret_my_secret'],