-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
'npm start' works without issues when not using containers, but 401 when containerized. Three files of project are posted below:
index.js
const spauth = require("node-sp-auth");
const request = require("request-promise");
spauth
.getAuth("http://20.107.64.34", {
username: "SP2016-FARM-ADMIN",
password: "njdfignds4<LP_",
domain: "SOCAFRICA",
})
.then((data) => {
let headers = data.headers;
headers["Accept"] = "application/json;odata=verbose";
let requestOpts = data.options;
requestOpts.json = true;
requestOpts.headers = headers;
requestOpts.url = "http://20.107.64.34/_api/web";
request.get(requestOpts).then((response) => {
console.log(response.d.Title);
});
});
package.json
{
"name": "spnodeauth-docker",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
},
"keywords": [],
"author": "Mike Chan",
"license": "ISC",
"dependencies": {
"node-sp-auth": "^3.0.7",
"request-promise": "^4.2.6"
}
}
Dockerfile
FROM node:16
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]
DakotaWray2
Metadata
Metadata
Assignees
Labels
No labels