I’m trying to use NTLM plugin with cypress in order to handle windows authentication.
On navigating to my test url the test fails, returning the following error in the cypress test runner ui ‘Username contains invalid characters or is too long’ I’ve verified that my username is correct and can be used manually to access the url.
In my test I’m using the following code to launch the page:
it('should launch the home page with the correct user', () => {
cy.ntlm(['localhost:1234'] , 'XYX\\firstname.lastname', 'Password');
cy.visit('https://localhost:1234')
})
As a string, my username is 'XYX\firstname.lastname' using this in the code treats the \ as an escape character hence the use of \
I’ve also tried using the url string in the format: ‘https://XYX\firstname.lastname:password@localhost:1234’
But this fails to launch the page
I suspect the problem is something to do to with the \ but im unsure on how to fix this.
Has anyone encountered the error ‘Username contains invalid characters or is too long’ when using ntlm and cypress and what did you do you resolve the issue?