# How can I track failed login attempts (is there a variable exposed)?

**URL:** <https://community.auth0.com/t/how-can-i-track-failed-login-attempts-is-there-a-variable-exposed/37118>\
**Category:** Get Help\
**Created:** [January 30, 2020, 5:46pm UTC](https://community.auth0.com/t/how-can-i-track-failed-login-attempts-is-there-a-variable-exposed/37118 "2020-01-30T17:46:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![phil.fitzgerald](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/phil.fitzgerald/32/16055_2.png) [@phil.fitzgerald](https://community.auth0.com/u/phil.fitzgerald)\
**Post date:** [January 30, 2020, 5:46pm UTC](https://community.auth0.com/t/how-can-i-track-failed-login-attempts-is-there-a-variable-exposed/37118/1 "2020-01-30T17:46:57Z")

</div>

I need to implement a Corporate login rule to lock an account based on the number of failed successive login attempts. I assume I will need a custom rule for this, but is there a variable available that would track this number?

---

<div class="post-metadata">

**Author:** ![colin.coutts](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/colin.coutts/32/17217_2.png) [@colin.coutts](https://community.auth0.com/u/colin.coutts)\
**Post date:** [January 30, 2020, 11:08pm UTC](https://community.auth0.com/t/how-can-i-track-failed-login-attempts-is-there-a-variable-exposed/37118/2 "2020-01-30T23:08:24Z")

</div>

Hi @phil.fitzgerald thanks for your question!

I might need to hear a bit more context surrounding how you’d like to block an account. If it’s just by consecutive failed login attempts have you considered our built in [Brute-Force Protection](https://auth0.com/docs/anomaly-detection/references/brute-force-protection-triggers-actions)? Here’s a bit more [information](https://auth0.com/docs/connections/database/rate-limits) on the topic as well.

In terms of variables you’d have access to within a rule, you should have access to the logins under ‘context.stats.loginsCount’ though I’d recommend utilizing some console.logs while building out your rule to confirm.

Best Regards,  
Colin

---

<div class="post-metadata">

**Author:** ![tbskibd](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/tbskibd/32/13728_2.png) [@tbskibd](https://community.auth0.com/u/tbskibd)\
**Post date:** [January 4, 2021, 9:53pm UTC](https://community.auth0.com/t/how-can-i-track-failed-login-attempts-is-there-a-variable-exposed/37118/3 "2021-01-04T21:53:57Z")

</div>

Hi,

I’m looking for the same information and I have to say this is absurd. context.stats.loginsCount seems to be referring to “login attempts”, without indication if it’s a “fail” or “success”? How do you know a login attempt is failed via that single variable or am I missing something?!

I’ve been digging through the documentation and cannot find anything that will help me (useless documentation not explaining in details what are the variables / properties on [Context Object Properties in Rules](https://auth0.com/docs/rules/context-object)) for example.
