Anyone know a good ouath1 library for signing requ...
# suitescript
a
Anyone know a good ouath1 library for signing requests to a restlet?
b
what language
a
Javascript
Node specifically
I built it manually in python and it was hell on earth.
b
you can make it generate a header for you
which is nice if you need to make it work with the non standard oauth role that netsuite uses
a
Thanks. I will take a look.
I am getting "the request cannot be understood due to malformed syntax" any ideas?
b
what does your code look like
a
Copy code
const ouath = OAuth({
        consumer: {
            key: clientid,
            secret: clientsecret
        },
        signature_method: 'HMAC-SHA256',
        hash_function: (base_string, key) => {
            return crypto.createHmac('sha256', key).update(base_string).digest("base64")
        }
    })

    header = ouath.toHeader(ouath.authorize({
        url: url,
        method: 'POST'
    }), token)

    header.Authorization+=`, realm="${realm}"`
    header['content-type']='application/json'


    console.log(header)

    axiosconfig = {
        headers: header,
    }


    <http://axios.post|axios.post>(url, body, axiosconfig).then((x) => console.log(x))
b
Init Options has a place for the realm
a
Is that's what's messing it up?
I replaced it and it didn't work.
b
i would fix that before checking the login audit trail
a
OK.