bjowes / cypress-ntlm-auth

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

getting "401 unauthorized" behind a corporate proxy #236

Closed Anonymous6666666666 closed 1 year ago

Anonymous6666666666 commented 1 year ago
          Hi, i'm getting the same error "401 Unauthorized" trying to reach my company's website which requires windows authentication. Point is that the same cypress project runs on my colleague's PC with same configurations and accesses. Could you please look up debug logs.

logs.txt

Originally posted by @Anonymous6666666666 in https://github.com/bjowes/cypress-ntlm-auth/issues/231#issuecomment-1559199290

Anonymous6666666666 commented 1 year ago

231 I forgot to mention that i can reach company's website in browser which is not being automated by cypress, but cannot open it in when i run browser by cypress. All proxy settings are same as my collegue's. It doesn't seem he bypasses proxy by any other way.

image

bjowes commented 1 year ago

Since there were no authentication errors in the logs, the server that replies with 401 does not seem to have been configured with cy.ntlm. Please look at the network tab of developer tools in your browser to determine which server (hostname) is replying with 401, and check if it is included in the config to cy.ntlm.

Anonymous6666666666 commented 1 year ago

image image

bjowes commented 1 year ago

Ok, looks like there is config in place for that server. When looking through the logs again, I see plenty of logs of requests to that server, (and properly detected that NTLM should be applied) - but there are no logs at all from responses or authentication attempts. Just like a firewall is silently dropping the outgoing traffic to that server.

Anonymous6666666666 commented 1 year ago

logs2.txt This is logs from another PC which gets "401 unauthorized" but still passes authentication and runs autotest till the end. Firewall settings are same as mine.

Anonymous6666666666 commented 1 year ago

image I've tried to put authentication token in cypress environment and it passed. However, it still crashes on halfway gettin "403 forbidden". image

bjowes commented 1 year ago

I think that you are trying to use this plugin for more that what it is capable of. From the logs I can deduce:

This plugin only support NTLM authentication (and Negotiate when using SSO) - Windows Authentication only. Your application seems to deal with several kinds of authentication protocols. Even though the plugin will forward all traffic that isn't NTLM, it slows things down and makes the logs quite hard to read when you configure the plugin to expect NTLM for lots of sites that doesn't use it. I would slim down the cy.ntlm config to include only '172.16.143.68:80'.

As for the other authentication, those are out of scope for this plugin so I cannot support you there.

Anonymous6666666666 commented 1 year ago

Ok, I'll keep search for solution. Anyway, thanks for your help.