Shu Jia
01/26/2024, 2:13 AMconst username = 'username@username.com';
const password = 'custsecret1'; //internal id of created API secret
//const password = 'hardcode password value works';
return encode.convert({
string: `${username}:${password}`,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
It does not work, also i tried
const username = 'username@username.com';
var secretKey = crypto.createSecretKey({
secret: '{custsecret1}'
});
log.debug('Secret ID', secretKey);
also no luck, logged {"secret":"{custsecret1}","encoding":"HEX"}
, then I tried
const username = 'username@username.com';
const password = 'custsecret1';
var secretKey = https.createSecureString({
input: "{" + password + "}"
});
return encode.convert({
string: `${username}:${secretKey}`,
inputEncoding: encode.Encoding.UTF_8,
outputEncoding: encode.Encoding.BASE_64
});
None of these work...Not sure which part went wrongbattk
01/26/2024, 2:37 AMbattk
01/26/2024, 2:38 AMbattk
01/26/2024, 2:38 AMbattk
01/26/2024, 2:39 AMShu Jia
01/26/2024, 3:41 AMcrypto.createSecretKey
and https.createSecureString
non of them work..
code from suiteanswer 100920 and 98376battk
01/26/2024, 8:41 AMbattk
01/26/2024, 8:42 AMbattk
01/26/2024, 8:46 AMbattk
01/26/2024, 8:47 AMbattk
01/26/2024, 8:47 AMbattk
01/26/2024, 8:49 AMbattk
01/26/2024, 8:51 AMbattk
01/26/2024, 8:52 AMbattk
01/26/2024, 8:53 AMbattk
01/26/2024, 8:54 AMbattk
01/26/2024, 8:58 AMbattk
01/26/2024, 9:14 AMTimothy Wong
01/26/2024, 2:20 PM${username}:${secretKey}
as the custsecret... Thats what I ended up doingShu Jia
01/26/2024, 3:18 PMconst username = '<mailto:username@username.com|username@username.com>';
const password = 'custsecret_internalid'; //custsecret id
//const password = 'xxxx-xxxx-xxxx' real password
const secStringKeyInBase64 = https.createSecureString({
input: "{" + username + "}:{" + password + "}"
});
secStringKeyInBase64.convertEncoding({
toEncoding: encode.Encoding.BASE_64,
fromEncoding: encode.Encoding.UTF_8
});
const secStringBasicAuthHeader = https.createSecureString({
input: "Basic "
});
secStringBasicAuthHeader.appendSecureString({
secureString: secStringKeyInBase64,
keepEncoding: true
});
const response = <http://https.post|https.post>({
url: url,
headers: {
HTTP: '1.1',
Accept: 'application/json',
Authorization: secStringBasicAuthHeader,
'Content-Type': 'application/json'
},
body: JSON.stringify(body)
});
battk
01/26/2024, 3:23 PMbattk
01/26/2024, 3:26 PM{username@username.com}:{custsecret_internalid}
battk
01/26/2024, 3:26 PMbattk
01/26/2024, 3:27 PMbattk
01/26/2024, 3:27 PMbattk
01/26/2024, 3:28 PMShu Jia
01/26/2024, 4:29 PM