Are you tracking your login failures? Learn about how to track them, why it matters, and what you should do to avoid login failure.
Picture a chart representing user logins. It has a line, trending upwards and to the right. Growing over time, never dipping.
When you care about providing great authentication experiences, like us (the few, the proud), there is nothing better than this chart - undeniable proof that our users are successfully logging in. And, more importantly, getting access to the features or data which that login process protects. That’s what most users are looking for, after all.
The more people who successfully log in, the more confident we are that our solution can handle a large number of users and that users are able to enter the application smoothly.
However, do you track login failures as much as you pay attention to login successes? At first,it doesn’t sound as exciting. You definitely won’t be hoping for a line up and to the right. Instead, you’ll be hoping for a line trending downwards. Or better yet, one never ascending in the first place.
Tracking login failure rates is just as important, if not more important, than tracking login success numbers. Failures signify users are having difficulty accessing the application, and it’s our job to figure out why. And to fix it.
Before you can measure, you have to decide on what you will consider a failure in the login process. A safe assumption is that any failed authentication event should be counted. Authentication is not as simple as a username and password pair, and scenarios around passwordless authentication and multi-factor authentication (MFA) need to be considered as well. If a user attempts to log in, uses their username/password pair successfully, but never completes MFA, this is considered a failure.
There are some scenarios that are not quite failures, and not quite successes. These are also worth tracking, but require some nuance in instrumentation and reporting. Some examples:
In all cases, the user is denied access to the application, but not in a typical manner. If you aren’t tracking login failures at all, don’t worry about these edge cases. But if you are and want to take the next step in terms of understanding your user’s experience, track these and think about how your user might perceive them.
The first step in working towards measuring failed authentication attempts is awareness - brought to you by this article!
Next, walk through what you should be doing::
Patience is key. You’ll need at least 3 months of solid data before you can start to zoom in to identify meaningful trends.
Adjust your expectations based on your industry. While it is difficult to find login failure rates based on your specific industry, they can range between 15-40%, based on the average of the stats between this article and this one. After tracking these numbers for a while, you’ll get a feel for when changes to your applications cause failure rates to change.
Pass it on. When building your application, empower application administrators to monitor failure rates themselves. For example, Okta gives admins a report where they can view failures and successes. Most authentication as a service providers offer detailed log events that can be built as a dashboard or report for administrator consumption.
Now that you know what you should be doing to track failures, let’s talk about why user authentication events fail.
There are a number of reasons why someone fails to log in. These range from system issues like performance to user confusion to obstacles from security measures.
Technical problems, such as slow response times from the application, cause major user attrition. A report by Google found that 53% of mobile users will leave a website if it takes longer than 3 seconds to load. Even if your application loads within a reasonable amount of time, you need to ensure that your login response is equally as zippy.
A poor user experience, often marked by unclear instructions and an overwhelming number of input fields, can cause frustration for users and lead to authentication failure. Poor UX can manifest in other ways, too:
Ah, the age old struggle between security and usability. Those same security features that help to project our application also cause friction for users. A CAPTCHA may make sense if a user is logging in from an unusual IP address, but presents an additional obstacle to the user.
A common security measure is to make a user click a magic link, sent to them via email or SMS, when a login looks suspicious. Any time a user has to go into another application (in this case, their email client or phone), just to use yours, they are at a higher risk of failed authentication.
Unnecessary steps in the flow for security purposes will slow down the login process, leading to a higher chance of user attrition and error. Choose security measures wisely.
An additional benefit of taking a baseline measurement as this article suggests above is that you can know how such measures affect your users.
You may do all you can to make the login process seamless for users, but failed attempts are a part of life. Why is that?
On the other end of your shiny, awesome login form, is a flawed human being. We forget our credentials. We forget if we used Google, Facebook, or LinkedIn to sign in. We entered our username, then got distracted and forgot to come back to the tab.
I could go on and on. Ultimately, expect that no matter how optimized your login process, there will be some percentage of failure due to the human condition.
You might ask, why do I care about login failures?
An authenticated user is more valuable to your business than an unauthenticated one. Once a user is tied to an identity, you can improve their experience:
When you improve the percentage of successful logins, you are directly creating business value.
Authentication is a high stakes, high visibility portion of your application. If a user can’t login, the application is dead in the water. When users can’t log in, they lose trust in your application - not to mention the general sense of annoyance that comes with wanting to access something that you can’t!
Alerting on login failure rates can give you a heads up that something isn’t right. The sooner you know, the sooner you can do something about it.
All things in software (and life) have tradeoffs, and tracking login failures is no exception. You may choose not to invest in this area for the following reasons:
Once you implement tracking, you may determine that you want to do something to improve your login failure rates. Here are some ideas for how to increase successful logins.
Provide automated help to anyone struggling to log in. Present tailored advice or reminders in the user experience based on the problem they’re experiencing. An example of this is offering to send a password reset email with one click after a certain number of failed login attempts. Or, if you’re noticing that legitimate-looking users are failing at the CAPTCHA step frequently, consider a CAPTCHA alternative.
Give secure options for account credentials reset. Once a problem has been detected, offer a login with a security code. Once the user is authenticated, allow them to modify their credentials so that they can remember them. For an added layer of security, send the user an email any time their username or password changes. In case it wasn’t them, they can be alerted of a possible malicious actor and take further steps such as changing their credentials or locking their account.
Give users options. Passwordless options, like passkeys and magic links, can replace username and password combinations. You can also provide the ability for users to authenticate with pre-existing accounts using social sign in, SAML, and OAuth2. Since you have metrics captured, you can determine which of these is most effective for your userbase.
Keep users logged in if they choose. Ensure your authentication system provides the ability for users to select “Remember me”. Long lived sessions reduce the need to log in, sometimes at the expense of security (tradeoffs, remember!). Administrators choose the maximum length of valid sessions before a user is forced to authenticate again. Here you’ll want to again balance between ease of use and security.
In the case of login failures, knowledge is power. Instrument your current login success and failure rates with granular data about each outcome. Understand why users are failing to authenticate, and take action accordingly.
Doing so will lead to the positive business outcomes associated with authenticated users, and maybe some beautiful looking charts, too.
There is much to be found in login rates, both successful and unsuccessful.
Something I've seen in more than one service are API clients that perform a fresh login for every call, using the newly issued session token exactly once regardless of how long it might be valid. This pretty much doubles the number of connections and request round trips that need to be handled on either end. No big deal in small amounts but adds up for larger / high rate clients.
If the system design involves a table of valid session tokens, API clients that behave like this can cause that table to grow faster than one might expect, leading to impacts on the session invalidation process or perf issues on the underlying data store.
> Something I've seen in more than one service are API clients that perform a fresh login for every call,
That largely comes from people copy+pasting examples from API documentation, sites like stack overflow, and (because they have been trained on a lot of code that does nothing more bright) LLMs, for the first call they make then following that for every call without even thinking to check if there is any longer expiry period listed on the response when they first pick up a token, even if the subsequent calls are made in immediate succession so there is practically no chance that the session has expired.
> If the system design involves a table of valid session tokens
That would generally be bad design IMO. If a timestamp is part of the token and the rest of the information used in its generation (except "static" secrets like salts & keys of course) is present too, there is no need to hit the database to verify a token (it can be done directly in CPU only which likely imposes a lot less wall-clock overhead than a DB call or even simple filesystem read) so no need to even store it there in the first place. This will increase the size of the token (it contains the shared source data as well as the result not just, say, a 256bit hash result) but some of the tokens I've seen in the wild seem large enough to contain a full bible chapter anyway so it appears token length is not a concern in many cases.
I've abandoned paid services and cancelled subscriptions (or left them 1 star reviews if they're apps) after they repeatedly log me out for no good reason (like an app update that cannot be bothered to preserve and migratie state caches between upgrades) , force me to retype my username each time sporadically etc.
If I am on the same device and requested my credentials to be remembered, then if you sporadically forget it, and there is a reasonable replacement for the service or I can opt to forego it, that service is DONE and has lost me as a customer.
I often say that the login is the front door to your application.
You may want it to look pretty, but what you really want is for folks to get through it as quickly as possible so they can get to the good stuff: the features of your application.
Tracking failure rates over time helps you make sure your front door is working.
(You also want to make sure only the right folks get through.)
I have had failed logins in a old but neccessary microsoft account about 20 times a day from Random IP's in Random Countries over the last 3 years (Could be more, but I only checked so far back)
I can see every attempt, unsuccessful as they are, which is nice, but I'm also surprised that there's no rate limiting
For an account that's never been outside of the American Continent, I'm surprised a Gazillion attempts from Russia, Africa, or even Czechia don't ring any alarms (Or if they do, aren't visible)