The 401 error in WordPress is caused by improper authentication while communicating with the WordPress web hosting server.
For example, if you have password-protected your WordPress admin folder, then not entering a password will show an HTTP 401 error page on the WordPress login and admin pages.
However, in some cases, you may see this error even without adding any special password protection to your website.
For example, WordPress security plugins can lock down your admin area during a brute-force attack.
Security measures taken by hosting companies to protect your WordPress website can also cause this error. They can trigger the 401 error code when your WordPress login web pages are accessed excessively.
Mostly, 401 errors appear on WordPress admin and login pages. That said, it could also appear on all pages of your website. You will need to troubleshoot exactly what's causing the error and then fix it.