How do I fix a 401 unauthorized error in Jmeter?

To avoid that please check Ignore Status checkbox so that the 401 Code won’t raise an error (as it is an expected result). Add a pattern with Add button and enter 401 (unauthorized), to verify that the response code equals 401. Run the test group and make sure that new test response code is 401 (unauthorized).

For More Information Please Refer: