bjowes / cypress-ntlm-auth

Windows authentication plugin for Cypress
MIT License
55 stars 9 forks source link

Am still getting a 401 unauthorized error when using this ntlm #177

Closed cdaniel-swi closed 3 years ago

cdaniel-swi commented 3 years ago

I added a script to run the ntlm plugin on my local box via package.json.

"cypress": "cross-env CYPRESS_NTLM_AUTH_API=https://localhost:5001/ cypress-ntlm open",

I then run npm run cypress and get this error.

image

Can someone let me know what I am doing wrong? I do run through windows auth and am getting the 401 unauthroized error in cypress.

bjowes commented 3 years ago

Hi @cdaniel-swi

A couple of things:

cdaniel-swi commented 3 years ago

Hi @cdaniel-swi

A couple of things:

  • Using HTTPS for CYPRESS_NTLM_AUTH_API is not supported. Change it to http://localhost:5001
  • Starting cypress-ntlm in this way requires that the ntlm-proxy has been already started manually, with the same setting for CYPRESS_NTLM_AUTH_API. Has this been done? Note that if you do not strictly need to set a specific port for the ntlm-proxy, or a separate instance of ntlm-proxy, it is easier to skip this variable - then cypress-ntlm will start the ntlm-proxy internally instead.

Hey @bjowes, Thanks for reaching back out. Without adding the proxy I get a 401. I started the ntlm proxy manually and got past the error I have shown above but Cypress still shows the 401 Unauthorized error when trying to run a base test.

image

I've verified locally that this page does load when not using cypress.

cdaniel-swi commented 3 years ago

I solved the issue. I needed to add

cy.ntlmSso(["localhost"]);

to the test and it worked.