Fix the 401 Unauthorized Error (5 Methods)
Getting an error page when trying to access a WordPress site, whether it’s yours or someone else’s, is inconvenient at best. Part of what makes a 401 error so annoying, as with many HTTP response codes, is the lack of information it provides for diagnosing and addressing the problem.
The 401 error can occur in any browser, making it a rather common problem. In most circumstances, resolving this issue is simple and uncomplicated.
We’ll go through what 401 error messages are and why they occur in this post. Then we’ll show you how to remedy problems using five different approaches.
Let’s get this party started!
Contents Table of Contents
What is the 401 Error Code?
An Overview of the 401 Error Code
What Does a 401 Error Mean?
How to Resolve a 401 Error (5 Methods)
What is the 401 Error Code?
The error 401 Unauthorized is defined by the Internet Engineering Task Force (IETF) as follows:
The 401 (Unauthorized) status code indicates that the request was not processed because the target resource’s authentication credentials were invalid. A WWW-Authenticate header field containing at least one challenge appropriate to the target resource MUST be sent by the server sending a 401 answer.
An Introduction to the 401 Error Code
When there is a problem making a request, HTTP 400 status codes are returned. When your browser denies you access to the page you’re trying to visit, you’ll get a 401 error.
As a result, the browser will display an error message instead of the web page. Because 401 problems can occur in any browser, the message displayed may vary.
In Chrome or Edge, for example, you’ll probably see a paper icon and a short notice informing you that the page in question isn’t working. At the bottom, it will say “HTTP Error 401” and tell you to contact the site’s owner if the problem persists:
In Chrome, there is a 401 error.
The Chrome 401 Error
You might see a somewhat less friendly warning that’s just a blank page with a “401 Authorization Required” message at other times and in different browsers:
Authorization error 401 Nginx 401 Authorization is required. Error message is required.
Other possibilities include:
“HTTP 401 Error – Unauthorized” “HTTP 401 Error – Unauthorized”
“401 Unauthorized” is an error message.
“Access Is Restricted”
These issues happen when you try to access a website that requires you to log in. In most circumstances, this indicates that either the credentials or the browser’s ability to read them as genuine are broken.
This is comparable to the HTTP 403 Forbidden Error in that the user is denied access. The 401 error message, unlike the 403 error, indicates that the authentication process failed.
The code is supplied as part of the WWW-Authenticate header, which identifies the authentication mechanism used to gain access to a web page or resource.
The HTTP 401 error is all too often, and this post will show you how to repair it the next time you see it. ✅
What Causes a 401 Error? CLICK TO TWEET
You’re dealing with a client-side (or browser-side) issue if you get an error code in the 400s. While the problem may appear to be coming from your browser, it doesn’t always indicate it’s the source of the problem, as we’ll explain later.
401 errors occur when accessing restricted resources, such as password-protected WordPress pages. As a result, it’s safe to presume that the authentication credentials are the source of the problem.
Cache and Cookies from an Outdated Browser
One of the most typical causes of a 401 error is that your browser’s cache and cookies have become out of current, preventing the authorization from being completed correctly. The server will refuse the request if your browser does not use proper authentication credentials (or any at all).
Incompatibility with Plugins
This error is occasionally triggered by a plugin incompatibility or problem. A firewall or security plugin, for example, may misinterpret your login attempt as harmful activity and produce a 401 error to protect the page.
A URL that is incorrect or a link that is no longer active
It’s also possible that the genesis of the issue is due to a tiny blunder. An poorly written URL or an out-of-date link are common offenders in this category.
How to Fix the 401 Error (5 Methods)?
Now that we’ve covered some background information on the 401 error, let’s talk about how to fix it.
Let’s look at five different approaches:
Check the URL for any errors.
Clear the Cache in Your Browser
Clean up your DNS
WordPress Plugins Should Be Deactivated
Examine the HTTP-Authenticate-Header-Response 1. Check the URL for any errors.
Let’s start with the simplest possible solution: double-checking that you used the proper URL. Although it may appear straightforward, 401 errors might occur if the URL is incorrectly entered.
Another option is that the URL you used to access the page in question is incorrect. It could, for example, be out of date or link to a page that no longer exists (and no redirects are in place).
As a result, you should double-check the URL you used. Verify that you spelt everything correctly if you typed it in yourself. If you clicked on a link, double-check that it leads to the page you’re looking for (or try to visit that page directly through the website).
2. Delete the Cache in Your Browser
The cache in your browser is intended to improve your online experience by lowering page load times. Unfortunately, it can occasionally generate unwelcome disruptions.
Do you want to discover how we grew our traffic by over 1000%?
Join the 20,000+ people who receive our weekly email with WordPress insider secrets!
Now is the time to subscribe.
One of the most typical causes of the 401 error, as previously stated, is obsolete or erroneous cache data or cookies. If there are no difficulties with the URL of the page, the next step is to delete your browser’s cache.
This will clear any invalid information from your browser’s local storage, which could be interfering with the authentication process. Similarly, your browser’s cookies may contain authentication data that requires only a refresh.
If you’re using Google Chrome, you can do this by heading to Settings from the menu icon in the top-right corner of the browser. Click Clear browsing data: under the Privacy and security section.
To repair a 401 problem, delete your browsing data.
Google Chrome’s Clear Browsing Data section
There will be a new window open. Make sure all three options are checked under the Basic menu, then select Clear data:
clear data in chrome
Chrome’s clear browsing data window
Other browsers will display this process differently. In Mozilla Firefox, for example, you’d go to the library icon in the top-right corner of the browser, then History > Clear Recent History:
clear history in firefox
In Firefox’s settings, select the ‘clean recent history’ option.
Select Everything in the drop-down menu at the top of the Panel that appears next, make sure “Cache” is selected, and then click the Clear Now button:
clear the cache in Firefox
Firefox’s ‘Clear History’ panel
Please refer to this guide for cleaning the cache if you’re using a different browser.
3. Clear your DNS cache
Flushing your Domain Name Server is another option for resolving the 401 error (DNS). While this is a less common problem, it could be the culprit, so it’s worth a go if the first two options don’t work.
Are you fed up with poor level 1 WordPress Hosting support that doesn’t provide answers? Try our world-class customer service! Take a look at our plans.
To do so in Windows, go to the Start menu and type cmd into the search box. The Command Prompt will open once you press Enter. Copy and paste the command ipconfig/flushdns into the command prompt, then press Enter:
at the command prompt
The Windows Command Prompt interface
If you’re using a Mac, go to Finder > Applications > Utilities > Terminal:
On a Mac, use the Terminal application.
Enter sudo killall -HUP mDNSResponder at the command prompt. Then, to see if the 401 error has been resolved, try refreshing the page you were trying to visit.
4. Turn off all of your WordPress plugins
It’s possible that the issue generating your 401 error has nothing to do with your browser. It’s also conceivable that one or more plugins are at blame if you’re experiencing problems accessing your WordPress site.
When some plugins, particularly security-focused plugins, detect suspicious login activity that could suggest an attack, they display a 401 error. Others may simply be experiencing compatibility issues. As a result, it’s a good idea to turn off all of your WordPress plugins and see if it helps.
By heading to Plugins > Installed Plugins in your dashboard, you can deactivate all of your plugins at once. To pick all of them, check the box at the top. Select Deactivate from the Bulk Actions drop-down menu, then click the Apply button:
The WordPress dashboard’s plugin deactivation setting
After that, examine if reloading the page that returned the 401 error has fixed the problem. If that’s the case, you can manually enable each plugin one at a time to see which is causing the issue.
Then you have the option of removing the plugin, replacing it with a new one, or contacting the plugin’s developer for help.
5. Examine the response to the WWW-Authenticate Header.
If the problem hasn’t been resolved at this time, it could be due to a server-side issue. As a result, our final repair will be a little more complicated.
The 401 answer is sent using the WWW-Authenticate header, which looks like this: “WWW-Authenticate: type> realm=realm>.” It contains ‘challenges,’ or data strings that specify what form of authentication is necessary before access is permitted.
In a nutshell, you’ll want to see if the header response was sent, as well as the authentication scheme that was utilized. This will, at the at least, help you narrow down the source of the problem and move you closer to a solution.
To do so, open the developer console in Chrome and navigate to the web page that is displaying the 401 error. You can inspect the page by right-clicking it and selecting Inspect, or by using Ctrl+Shift+J.
Reload the page after clicking the Network tab. A list of resources will be generated as a result of this. To arrange the table and get the 401 status code, select the Status header:
401 error on the network
In Chrome’s developer console, the 401 status code
After selecting that entry, go to the Headers tab. Look for the WWW-Authenticate header in the Response Headers section:
header www authenticate
The developer console’s Response Headers section
The information in the response header, particularly the authentication schemes, can help you figure out what’s going on and point you in the right direction. It might assist you in determining the type of authentication the server expects.
The authentication scheme in the above example, for example, is “Basic.” This means that the authentication request should just ask for a user name and a password. The HTTP Authentication Scheme Registry is a good place to go for more information and instructions on how to use this information.
HTTP 401 errors, get out of here! 5 simple ways to get rid of those annoying messages (no magic required)
TO TWEET, CLICK HERE
You may encounter problems like the 401 error when your browser and server are having trouble communicating or authenticating requests. While this is an annoyance, the notice is usually just transitory and may be fixed.
Here are five options for resolving the 401 error:
Examine the URL for any problems.
Clear the cache in your browser.
Clear your DNS cache.
Deactivate any WordPress plugins you have installed.
Examine the response to the WWW-Authenticate header.
Save time, money, and improve site performance by using:
Expert WordPress Hosting assistance is available 24 hours a day, 7 days a week.
Integration with Cloudflare Enterprise.
With 29 data centers across the world, we can reach a global audience.
With our built-in Application Performance Monitoring, you can improve your performance.
All of this and more is included in a single plan that includes no long-term obligations, aided migrations, and a 30-day money-back guarantee. Check out our plans or speak with a sales representative to find the ideal plan for you.