Does anyone have experience using the "credentials...
# suitescript
a
Does anyone have experience using the "credentials" attribute when sending a post message with the https module? I have a GUID of a password field that I would like to send, but I can't figure out how to get it to decrypt the password before sending it (the server responds with invalid login).
Copy code
var secureStringPWD = https.createSecureString({
            input: '{' + tokenGuid + '}'
        });

        var bodyObj = {
            username: tokenUser,
            password: secureStringPWD
        };

        var response = <http://https.post|https.post>({
            url: tokenUrl,
            credentials: [tokenGuid],
            body: bodyObj,
            headers: {
                'Accept': 'application/json'
            }
        });
b
best practice for learning credentials ive found is setup the credential's restrictToDomains to an echo service like httpbin.org
it will include the request you make in the response so that you can see what netsuite is sending in the request
m
Very helpful, @battk. Would you happen to have any suggestions for identifying the appropriate value to use for
restrictToDomains
based on a
url
? I could get the expected request with the echo service but encounter
INVALID_DOMAIN
when trying my use case.
b
m
okay, thanks. I got it to work using a period in front of what I thought the domain would be. If anyone else encounters something similar, google was able to give it to me by listing the domain in the session cookies
message has been deleted