Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

401 against on-premises when using containers #128

Open
chanm003 opened this issue Aug 25, 2023 · 2 comments
Open

401 against on-premises when using containers #128

chanm003 opened this issue Aug 25, 2023 · 2 comments

Comments

@chanm003
Copy link

'npm start' works without issues when not using containers, but 401 when containerized. Three files of project are posted below:
401-when-running-inside-container

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
Copy link

@chanm003 Did you discover a solution?

@koltyakov
Copy link
Contributor

koltyakov commented Mar 15, 2024

Maybe something related to windows? As the a can't repro a similar ticket issue (works for me).

Does it work for you outside Docker?

UPD: I see this ticket is old, unlikely we'll get a response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants