{
headers: {
Connection: 'Close',
Authorization: 'NTLM TlRMTVNTUAADAAAAGAAYAEAAAADqAOoAWAAAAAkACQBCAQAADgAOAEsBAAALAAsAWQEAAAAAAAAAAAAABoKJAs98GvVVaGG2yLYfeWzsfmpI6Uk2XnJ2AkQWr5sblQlSxNsTTxUs/nABAQAAAAAAABBfMSfWDNYBSOlJNl5ydgIAAAAAAgASAFMARQBHAFMATwBDAEkAQQBMAAEAFABTAFIAVgA0ADAAQQBQAFAAMgA4AAQAHgBzAGUAZwBzAG8AYwBpAGEAbAAuAGwAbwBjAGEAbAADADQAUwBSAFYANAAwAEEAUABQADIAOAAuAHMAZQBnAHMAbwBjAGkAYQBsAC4AbABvAGMAYQBsAAUAHgBzAGUAZwBzAG8AYwBpAGEAbAAuAGwAbwBjAGEAbAAHAAgAzTYlJ9YM1gEAAAAAAAAAAHNlZ3NvY2lhbHJpY2FyZG8udi5kaWFzSUlFUzI2Ri0xMTU='
},
options: {
agent: Agent {
_events: [Object: null prototype],
_eventsCount: 2,
_maxListeners: undefined,
defaultPort: 80,
protocol: 'http:',
options: [Object],
requests: {},
sockets: {},
freeSockets: [Object],
keepAliveMsecs: 1000,
keepAlive: true,
maxSockets: Infinity,
maxFreeSockets: 256,
[Symbol(kCapture)]: false
}
}
}
.then((data) => {
console.log(data);
const info = $REST.Web(url).Lists("Tiago").getInfo();
info.headers["Authorization"] = data.headers.Authorization;
request({
method: info.method,
headers: info.headers,
uri: info.url,
json: true,
})
.then((res) => console.log("»»» ", JSON.parse(res).d))
.catch((err) => console.log(">>> ", err));
});
spauth
.getAuth("http://sharedev.seg-social.pt/sites/rpa/_api/web?$select=Title", {
username: "user",
password: "passowrd",
domain: "segsocial",
})
.then((res) => console.log(res));
@slowdata I'm suggesting trying something as shown in that https://github.com/s-KaiNet/sp-request#get-list-by-title sample.
spauth .getAuth("http://sharedev.seg-social.pt/sites/rpa/_api/web?$select=Title", { username: "user", password: "passowrd", domain: "segsocial", }) .then((res) => console.log(res));
That won't gonna work this way.
the password must be encripted?
No, it should not be encrypted when passing to node-sp-auth.
const uri = `"https://share.seg-social.pt/sites/iss_dpc/covid19_MedidasExcecionais/_api/lists/GetByTitle('BO_SSD_teste')/items({${id}})/AttachmentFiles/add(FileName='{test.csv}')`;
const r = await spr.post(uri, {
body: f,
headers: {
"X-RequestDigest": digest,
"X-HTTP-Method": "POST",
"IF-MATCH": "*",
"Content-Length": f.length,
},
});