# Supabase auth: display invalid credentials message on invalid login attempt

**URL:** <https://community.weweb.io/t/supabase-auth-display-invalid-credentials-message-on-invalid-login-attempt/1492>\
**Category:** How do I?\
**Tags:** authentication\
**Created:** [November 25, 2022, 8:19pm UTC](https://community.weweb.io/t/supabase-auth-display-invalid-credentials-message-on-invalid-login-attempt/1492 "2022-11-25T20:19:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bildaps](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bildaps](https://community.weweb.io/u/bildaps)\
**Post date:** [November 25, 2022, 8:19pm UTC](https://community.weweb.io/t/supabase-auth-display-invalid-credentials-message-on-invalid-login-attempt/1492/1 "2022-11-25T20:19:12Z")

</div>

When a user makes an invalid login attempt, for example, with a wrong password, or an unregistered email address, I’d like to display the returned error message to them on the login screen.

**For example, a user attempts to login as:**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/e/ef319adf40d60f5fdd96b91f753799a5a4d237ba.png)

**Then, this returns in console:**

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/0/01d1496e8c33a05fa136a5ac18f466758760676f.png)

**When that auth response is received, I’d like to display it to the user, as currently nothing is displayed, so it appears like the form is not working, which I’d like to avoid by showing this:**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/5cb795b044aece9a332ec5edaf05df3c73b7e90f.png)

How can I catch that error and display the message to the user?

---

<div class="post-metadata">

**Author:** ![bildaps](https://avatars.discourse-cdn.com/v4/letter/b/ac91a4/32.png) [@bildaps](https://community.weweb.io/u/bildaps)\
**Post date:** [November 28, 2022, 12:06am UTC](https://community.weweb.io/t/supabase-auth-display-invalid-credentials-message-on-invalid-login-attempt/1492/2 "2022-11-28T00:06:29Z")

</div>

Ok, so I found the solution to this:

**1. In your Login Workflow, toggle to the On Error mode, add a (Change variable value) action, and create a new Text Variable:**

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/aca1f3cf9c86abd27f3537b180353107c8e0e4bd.png)

**2. Add dummy data at the Login Form so that we can run a workflow test to simulate an invalid login attempt:**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/3/34dacaf2c8c604ea51b51ec173aa4776900613f6.png)

**3. Run the workflow test to see the error:**

![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a75a998619bbd5f90d5ce7a792ba6a88a19ad5fd.png)

**4. Assign the error (Message) to the Text Variable from step 1:**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/2/2da4b86d7c58fe100fc82070f1ea97bee6529873.png)

**5. Add a text Label to the login form, and bind it to the Text Variable:**

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/9/995e2c5840eae0181331589734ca644616c847b3.png)

**Now, any type of error encountered during the login flow will be returned to the user.**

_Unregistered user, or wrong credentials, return this:_

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/a/a5a0b279260ce6a8c715946f05ff582c168ab048.png)

_Blank login returns this:_

 ![image](https://us1.discourse-cdn.com/flex016/uploads/weweb/original/2X/5/5c55c166707d09837008618e657aa42faba5aa51.png)

---

<div class="post-metadata">

**Author:** ![aurelie](https://sea2.discourse-cdn.com/flex016/user_avatar/community.weweb.io/aurelie/32/13249_2.png) [@aurelie](https://community.weweb.io/u/aurelie)\
**Post date:** [November 28, 2022, 12:26pm UTC](https://community.weweb.io/t/supabase-auth-display-invalid-credentials-message-on-invalid-login-attempt/1492/3 "2022-11-28T12:26:06Z")

</div>

Thanks to have taken time to post your answer 🙂
