# Access\_denied on sending login request more than once

**URL:** <https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655>\
**Category:** Get Help\
**Tags:** access\_denied, bug, login\
**Created:** [September 29, 2020, 2:18pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655 "2020-09-29T14:18:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![JamieQeexo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@JamieQeexo](https://community.auth0.com/u/JamieQeexo)\
**Post date:** [September 29, 2020, 2:18pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/1 "2020-09-29T14:18:37Z")

</div>

Hi,

I received a bug report on my customized login page from my collages.  
They occasionally encounter “oops!, something went wrong” with an error message below:

```auto
access_denied: Password login via OIDC-conformant clients with externally-hosted login pages is unsupported. Alternatively, login could have been initiated from the wrong place (e.g., a bookmark).

```

I was able to reproduce this issue by double-clicking the login button; basically, when a block of code below get executed more than once:

```auto
webAuth.login({
    realm: DATABASE_CONNECTION,
    username: username,
    password: password
}

```

I am curious what the root cause of this issue is from Auth0 side.

---

<div class="post-metadata">

**Author:** ![joseantonio.rey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joseantonio.rey/32/14670_2.png) [@joseantonio.rey](https://community.auth0.com/u/joseantonio.rey)\
**Post date:** [September 29, 2020, 3:08pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/2 "2020-09-29T15:08:08Z")

</div>

Hello, @JamieQeexo - welcome to the Auth0 Community!

This is being caused by a race condition. When performing the login attempt, Auth0.js generated a state, but the state is being used twice because of the double click. Since states can only be used once, Auth0 errors out to prevent CSRF.

Let me know if this helps.

---

<div class="post-metadata">

**Author:** ![JamieQeexo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@JamieQeexo](https://community.auth0.com/u/JamieQeexo)\
**Post date:** [September 29, 2020, 4:08pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/4 "2020-09-29T16:08:21Z")

</div>

Hello @joseantonio.rey,

Thank you for your fast reply!

Given the fact that it is expected behavior from Auth0, do you think it is best practice for me to prevent double-click from my end then?

---

<div class="post-metadata">

**Author:** ![joseantonio.rey](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/joseantonio.rey/32/14670_2.png) [@joseantonio.rey](https://community.auth0.com/u/joseantonio.rey)\
**Post date:** [September 29, 2020, 4:15pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/5 "2020-09-29T16:15:14Z")

</div>

Hey @JamieQeexo,

Yep, indeed. I would prevent double-clicking, or to only process the first click. Otherwise, your users would be prone to hitting this race condition.

---

<div class="post-metadata">

**Author:** ![JamieQeexo](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@JamieQeexo](https://community.auth0.com/u/JamieQeexo)\
**Post date:** [September 29, 2020, 4:24pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/6 "2020-09-29T16:24:27Z")

</div>

Hi @joseantonio.rey,

Thank you so much for your opinion!  
I will reach out to you if disabling double-clicking do not prevent this race condition.

Thanks again.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [October 14, 2020, 4:24pm UTC](https://community.auth0.com/t/access-denied-on-sending-login-request-more-than-once/50655/7 "2020-10-14T16:24:35Z")

</div>

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.
