bjowes / cypress-ntlm-auth

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

Unsupported protocol error when attempting login with cypress-ntlm-auth #259

Closed ryan-g2 closed 3 months ago

ryan-g2 commented 3 months ago

Hi @bjowes , I am trying to use the cypress-ntlm-auth plugin to access a few pages on my companies' intranet and I am having trouble getting the plugin to work.

I downloaded the plugin, configured it, but when I run my test I see this in the debug output:

cypress:plugin:ntlm-auth Received 401 with unsupported protocol in www-authenticate header. Negotiate Ignoring. +0ms

A bigger debug log dump is below.

I am using this as my test:

before('before the test', () => {
    cy.ntlm(['*.wellcare.com'], username, pass, domain)
}

it('the test', () => {
    cy.visit(URL)
}

NOTE: When I log onto the page manually I see my login in the upper right displayed as 'Domain/Username', so I use that domain in the snippet above. This domain is different than the wellcare domain called out when calling cy.ntlm().

I am unsure if I need to use the cy.ntlmSso command that is mentioned in the readme file. Please let me know if I need to use this as well.

I am using Cypress 13.9 on a Windows machine. The rest of my Cypress project is JS based, not TS, so I am also unsure if I need to pay attention to the transpiling portion of the readme.

Any help would be appreciated since I am running low on other options to try to log into the front end of this site.

cypress:plugin:ntlm-auth getTargetHost - host header 127.0.0.1:57122 +20s cypress:plugin:ntlm-auth Created agent for client 127.0.0.1:63581 to target http://127.0.0.1:57122/ +0ms cypress:plugin:ntlm-auth Request to config API +0ms cypress:plugin:ntlm-auth Created untracked agent for target http://127.0.0.1:57122/ +0ms cypress:plugin:ntlm-auth Received valid NTLM config update +4ms cypress:plugin:ntlm-auth Added new hosts [ '*.wellcare.com' ] +1ms cypress:plugin:ntlm-auth getTargetHost - host header 127.0.0.1:57122 +0ms cypress:plugin:ntlm-auth getTargetHost - host header ccmuiservicesuat.wellcare.com:80 +10ms cypress:plugin:ntlm-auth Created agent for client 127.0.0.1:63583 to target http://ccmuiservicesuat.wellcare.com/ +0ms cypress:plugin:ntlm-auth Request to http://ccmuiservicesuat.wellcare.com/ in registered NTLM Hosts +0ms cypress:plugin:ntlm-auth getTargetHost - host header ccmuiservicesuat.wellcare.com:80 +194ms cypress:plugin:ntlm-auth Received 401 with unsupported protocol in www-authenticate header. Negotiate Ignoring. +0ms

ryan-g2 commented 3 months ago

As it turns out, after I wrote the above post I went back to revisit the readme. I noticed "(and Negotiate when using SSO)" in the first paragraph.

I set up my test to use cy.ntlmSso alone instead of along with `cy.ntlm' (I wasn't sure from my 1st few reads of the Readme if theses were meant to run together) - I previously tried them together with no luck. I now tried ntmlSso alone and it worked stupidly easy.

So thanks for writing this plugin, I am not sure how I would get this login to work without it. I was searching for a few days for a solution before I found this and didn't see any that looked remotely easy to use with Cypress.

ryan-g2 commented 3 months ago

closing since this is now working