# Do not create user entry if login failed

**URL:** <https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521>\
**Category:** Get Help\
**Tags:** login-experience, new-universal-login-experience\
**Created:** [July 18, 2023, 3:06pm UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521 "2023-07-18T15:06:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deimas](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/deimas/32/48994_2.png) [@deimas](https://community.auth0.com/u/deimas)\
**Post date:** [July 18, 2023, 3:06pm UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521/1 "2023-07-18T15:06:07Z")

</div>

Hello,

Currently user entry is saved in auth0 database even though user login flow failed, when user connects via SSO. How to avoid user creation if in login workflow action: “onExecutePostLogin” user is redirected and token is not issued?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 19, 2023, 9:55pm UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521/2 "2023-07-19T21:55:35Z")

</div>

Hello there @deimas welcome to the community!

> [@deimas](#):
>
> How to avoid user creation if in login workflow action: “onExecutePostLogin” user is redirected and token is not issued?

Unfortunately, the user will already have been created by the time the Post Login Action runs. The only thing I can really think of is keeping track of the user one way or another and then utilizing the [Management API to delete](https://auth0.com/docs/api/management/v2/users/delete-users-by-id) said user.

---

<div class="post-metadata">

**Author:** ![deimas](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/deimas/32/48994_2.png) [@deimas](https://community.auth0.com/u/deimas)\
**Post date:** [July 20, 2023, 5:48am UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521/4 "2023-07-20T05:48:09Z")

</div>

Is it possible to delete user from auth0 database in login flow? E.G. I add some user metadata that user is deletable and during an action I delete it?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [July 20, 2023, 7:12pm UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521/5 "2023-07-20T19:12:52Z")

</div>

That should technically be possible, although not a typical flow - When would the metadata be added? I’m just thinking back to your original question regarding failed login.

---

<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:** [August 3, 2023, 7:13pm UTC](https://community.auth0.com/t/do-not-create-user-entry-if-login-failed/111521/6 "2023-08-03T19:13:29Z")

</div>

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