bjowes / cypress-ntlm-auth

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

Windows authenticated is opening in another tab #223

Closed Rashminair88 closed 1 year ago

Rashminair88 commented 1 year ago

Hello,

I am trying to automate an internal site using ntlm. Below is the code used for it

loginXbertTest() { it('Login - Submission Engine', () => { cy.ntlm(Cypress.env('submissionEngine'), Cypress.env('uname'), Cypress.env('password')); cy.visit(Cypress.env('submissionEngine')+"/pages/se-search", { headers: { "Accept-Encoding": "gzip, deflate" } }); } )}

But what happens is, its opening a tab on top of runner and I can't see the test runner at all

Thanks, Rashmi

bjowes commented 1 year ago

Hi @Rashminair88

From the network traffic it seems that login is done through login.microsoftonline.com. This leads me to believe that your site does not use Windows Authentication (which is supported by the plugin), but rather OAuth from an Office 365 account or similar.

To verify this, please enable "preserve log" in the chrome developer tools and rerun the test. Typically you should see a 401 response to some request before the redirect to the Microsoft login page. Inspect that response, look for the headers "www-authenticate". They list the supported authentication methods. If they include NTLM or Negotiate then my plugin should work and we can keep troubleshooting. If not, please look for OAuth solutions instead, there are plenty documented ways to do that with cypress.

Rashminair88 commented 1 year ago

Yeah Its OAuth authenticatipn. Will try to use OAuth.

Thanks for the reply